<template>
    <div>
        <el-card>
            <div slot="header" style="display: flex; justify-content: space-between">
                <span style="font-size: 16px"><i class="el-icon-collection"></i>STEP1:选择样衣列表</span>
            </div>
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                label-width="68px">
                <!-- <el-form-item label="" prop="sampleTalentInfoId">
        <el-input v-model="queryParams.sampleTalentInfoId" placeholder="达人信息表ID" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="" prop="sampleTalentCooperateId">
        <el-input v-model="queryParams.sampleTalentCooperateId" placeholder="笔记/直播合作ID" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item> -->

                <!-- <el-form-item label="" prop="templateSecondryId">
        <el-input v-model="queryParams.templateSecondryId" placeholder="颜色ID" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="" prop="templateSizeId">
        <el-input v-model="queryParams.templateSizeId" placeholder="尺寸ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="" prop="contactId">
        <el-input v-model="queryParams.contactId" placeholder="联系方式ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item> @change="changeState" color: rgb(37, 137, 255):'' :style="!state ? color: rgb(37, 137, 255) : ''"-->
                <el-form-item>
                    <el-radio-group v-model="queryParams.exportParam" size="small" fill="#66b1ff" @change="changeState">
                        <el-radio :label="'personal'">我名下的</el-radio>
                        <el-radio :label="'depart'" v-hasPermi="['product:sampleApply:deplist']">部门记录</el-radio>
                        <el-radio :label="'all'" v-hasPermi="['product:sampleApply:alllist']">所有记录</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item>
                    <!-- <el-button size="mini" plain :icon="!state ? 'el-icon-lock' : ''" @click="MySampleTalentApply">我的申请</el-button> -->

                    <el-button :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" size="mini"
                        @click="shouqi">展开/收起</el-button>
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                    <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                </el-form-item>
                <div>
                    <el-form-item label="" prop="applyStatus">
                        <!-- <el-input v-model="queryParams.applyStatus" placeholder="模板ID" clearable @keyup.enter.native="handleQuery" /> -->
                        <el-radio-group v-model="queryParams.applyStatus" size="small" @change="changeTheme" fill="#66b1ff">
                            <el-radio :label="null">所有状态</el-radio>
                            <el-radio :label="'to_apply'">待提交申请</el-radio>
                            <el-radio :label="'dingding_approval'">待钉钉审核</el-radio>
                            <!-- <el-radio :label="'product_supervisor'">待产品中心经理审核</el-radio>
          <el-radio :label="'manage_approval'">待经理审核</el-radio>
          <el-radio :label="'commodity_approval'">待商品部审核</el-radio> -->
                            <el-radio :label="'shipped_ready'">待发货</el-radio>
                            <el-radio :label="'shipped'">已发货</el-radio>
                            <el-radio :label="'to_signed'">待签收</el-radio>
                            <el-radio :label="'signed'">已签收</el-radio>
                            <el-radio :label="'to_returned'">待退货</el-radio>

                            <el-radio :label="'returning'">退货中</el-radio>
                            <el-radio :label="'part_returned'">部分退样</el-radio>
                            <el-radio :label="'returned'">已退样</el-radio>
                            <el-radio :label="'canceled'">已取消</el-radio>
                            <!-- <el-radio :label="'not_return'">不归还</el-radio> -->
                            <el-radio :label="'end'">结束</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </div>
                <el-form-item label="" prop="isReturn">
                    <!-- <el-input v-model="queryParams.isReturn" placeholder="模板ID" clearable @keyup.enter.native="handleQuery" /> -->
                    <el-radio-group v-model="queryParams.isReturn" size="small" @change="changeReturn" fill="#66b1ff">
                        <el-radio :label="null">所有</el-radio>
                        <el-radio :label="'是'">归还</el-radio>
                        <el-radio :label="'否'">不归还</el-radio>
                    </el-radio-group>
                </el-form-item>

                <div v-if="isOpen">
                    <el-form-item label="" prop="id">
                        <el-input v-model="queryParams.id" placeholder="申请ID" clearable @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <!-- <el-form-item label="" prop="onlineNumber">
          <el-input v-model="queryParams.onlineNumber" placeholder="线上订单号" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="subOrderNumber">
          <el-input v-model="queryParams.subOrderNumber" placeholder="子订单编号" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item> -->
                    <el-form-item label="" prop="applyDateStart">
                        <el-date-picker clearable v-model="queryParams.applyDateStart" type="date" value-format="yyyy-MM-dd"
                            placeholder="请选择开始申请日期">
                        </el-date-picker>
                    </el-form-item>
                    -
                    <el-form-item label="" prop="applyDateEnd">
                        <el-date-picker clearable v-model="queryParams.applyDateEnd" type="date" value-format="yyyy-MM-dd"
                            placeholder="请选择结束申请日期">
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item label="" prop="platform">
                        <el-input v-model="queryParams.platform" placeholder="平台名称" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="platformId">
                        <el-input v-model="queryParams.platformId" placeholder="平台ID" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="xhsNickname">
                        <el-input v-model="queryParams.xhsNickname" placeholder="昵称" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <!-- <el-form-item label="" prop="paymentOrderNumber">
          <el-input v-model="queryParams.paymentOrderNumber" placeholder="支付单号" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="paymentMethod">
          <el-input v-model="queryParams.paymentMethod" placeholder="付款方式" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="freight">
          <el-input v-model="queryParams.freight" placeholder="运费" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="payableAmount">
          <el-input v-model="queryParams.payableAmount" placeholder="应付金额" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="fixedLine">
          <el-input v-model="queryParams.fixedLine" placeholder="固话" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="zipCode">
          <el-input v-model="queryParams.zipCode" placeholder="邮编" clearable @keyup.enter.native="handleQuery" />
        </el-form-item> -->

                    <el-form-item label="" prop="productNo">
                        <el-input v-model="queryParams.productNo" placeholder="款式" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="brand">
                        <!-- <el-input
            v-model="queryParams.brand"
            placeholder="选择品牌"
            clearable
            @keyup.enter.native="handleQuery"
          /> -->
                        <el-select v-model="queryParams.brand" placeholder="选择品牌" clearable filterable>
                            <el-option v-for="dict in dict.type.sys_product_pp" :key="dict.value" :label="dict.label"
                                :value="dict.label" />
                        </el-select>
                    </el-form-item>
                    <!-- <el-form-item label="" prop="productCode">
          <el-input v-model="queryParams.productCode" placeholder="商品编码" clearable @keyup.enter.native="handleQuery" />
        </el-form-item> -->

                    <!-- <el-form-item label="" prop="productNum">
          <el-input v-model="queryParams.productNum" placeholder="商品数量" clearable @keyup.enter.native="handleQuery" />
        </el-form-item> -->
                    <!-- <el-form-item label="" prop="productName">
          <el-input v-model="queryParams.productName" placeholder="商品名称" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="productPricing">
          <el-input v-model="queryParams.productPricing" placeholder="商品单价" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="productCost">
          <el-input v-model="queryParams.productCost" placeholder="商品成本" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="productSettlment">
          <el-input v-model="queryParams.productSettlment" placeholder="结算金额" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="productBatch">
          <el-input v-model="queryParams.productBatch" placeholder="生产批次" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="manufactureDate">
          <el-date-picker clearable v-model="queryParams.manufactureDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择生产日期">
          </el-date-picker>
        </el-form-item> -->

                    <!-- <el-form-item label="" prop="expressCompany">
          <el-input v-model="queryParams.expressCompany" placeholder="快递公司" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        
        <el-form-item label="" prop="deliveryTime">
          <el-date-picker clearable v-model="queryParams.deliveryTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择发货时间">
          </el-date-picker>
        </el-form-item> -->

                    <!-- <el-form-item label="" prop="salesman">
          <el-input v-model="queryParams.salesman" placeholder="业务员" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="" prop="offlineNotes">
          <el-input v-model="queryParams.offlineNotes" placeholder="便签|线下备注" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item> -->

                    <!-- <br /> -->
                    <el-form-item label="" prop="buyerAccount">
                        <el-input v-model="queryParams.buyerAccount" placeholder="申请人" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="responsiblePerson">
                        <el-input v-model="queryParams.responsiblePerson" placeholder="负责人" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="signedTimeStart">
                        <el-date-picker clearable v-model="queryParams.signedTimeStart" type="date"
                            value-format="yyyy-MM-dd" placeholder="请选择开始签收日期">
                        </el-date-picker>
                    </el-form-item>
                    -
                    <el-form-item label="" prop="signedTimeEnd">
                        <el-date-picker clearable v-model="queryParams.signedTimeEnd" type="date" value-format="yyyy-MM-dd"
                            placeholder="请选择结束签收日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" prop="expressNumber">
                        <el-input v-model="queryParams.expressNumber" placeholder="快递单号" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="recipient">
                        <el-input v-model="queryParams.recipient" placeholder="收件人" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="phone">
                        <el-input v-model="queryParams.phone" placeholder="电话" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="bindingSoid">
                        <el-input v-model="queryParams.bindingSoid" placeholder="内部订单号" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="productCode">
                        <el-input v-model="queryParams.productCode" placeholder="商品编码" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="address">
                        <el-input v-model="queryParams.address" placeholder="收件人地址" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="" prop="productSeasonList">
                        <el-select allow-create v-model="queryParams.productSeasonList" placeholder="请选择商品-季节" clearable>
                            <el-option v-for="dict in dict.type.sys_product_jijie" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" prop="firstLevelColumnList">
                        <el-select allow-create v-model="queryParams.firstLevelColumnList" placeholder="请选择一级类目" clearable
                            multiple>
                            <el-option v-for="dict in dict.type.sys_product_pl" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" prop="secondLevelColumnList">
                        <el-select allow-create v-model="queryParams.secondLevelColumnList" placeholder="请选择二级类目" clearable
                            filterable multiple>
                            <el-option v-for="dict in dict.type.sys_product_secondary" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" prop="threeLevelColumnList">
                        <el-select allow-create v-model="queryParams.threeLevelColumnList" placeholder="请选择三级类目" clearable
                            multiple filterable style="width: 150px">
                            <el-option v-for="dict in dict.type.sys_product_cycle" :key="dict.label" :label="dict.label"
                                :value="dict.label" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" prop="liveRoomName">
                        <el-select v-model="queryParams.liveRoomName" clearable placeholder="直播间名称" filterable>
                            <el-option v-for="(val, key) in liveroomList" :key="key" :label="val.liveStreamRoom"
                                :value="val.liveStreamRoom" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" prop="dataStatus">
                        <el-select v-model="queryParams.finalIsReturnList" placeholder="最终是否归还" clearable multiple>
                            <el-option v-for="dict in dict.type.sys_final_return" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                        </el-select>
                    </el-form-item>
                </div>
                <!-- <el-form-item label="逻辑删除;0=未删除；1=已删除" prop="isDelete">
        <el-input v-model="queryParams.isDelete" placeholder="逻辑删除;0=未删除；1=已删除" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item> -->
            </el-form>

            <!-- <el-row :gutter="10" class="mb8">
            <el-col :span="1.5" style="display: none">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                    v-hasPermi="['product:sampleApply:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                    v-hasPermi="['product:sampleApply:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['product:sampleApply:remove']">删除</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['product:sampleApply:export']">导出</el-button>
            </el-col>

            <el-col :span="1.5">
                <el-button size="mini" plain icon="el-icon-upload" @click="daoru">导入</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button size="mini" plain icon="el-icon-plus" @click="ToDoapply">申请</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button size="mini" plain icon="el-icon-plus" @click="ToDobutton"
                    v-hasPermi="['product:sampleApply:uploadJst']" v-show="this.roles.includes('admin')">一键推单</el-button>
            </el-col>

            <el-col :span="1.5" v-show="this.TypeCheck">
                <el-button size="mini" type="danger" plain icon="el-icon-bell" @click="ToDo">我的待办:{{ this.listSample
                }}</el-button>
            </el-col>
            <el-col :span="1.5" v-show="this.openCheck">
                <el-button size="mini" plain icon="el-icon-plus" @click="ToDoCheck">审批</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button size="mini" plain @click="chatReturn"
                    v-hasPermi="['product:sampleApply:returnApplyByApplyID']">发起退货</el-button>
            </el-col>

            <el-col :span="1.5">
                <el-button v-show="this.roles.includes('admintest') || this.roles.includes('admin')
                    " size="mini" plain @click="handlecheckDingdingStatus">检测钉钉状态</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button v-show="this.roles.includes('admintest') || this.roles.includes('admin')
                    " size="mini" plain @click="handlecheckPackageStatus">检测发货状态</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button @click="handleIsReturn" size="mini" plain
                    v-hasPermi="['product:sampleApply:batchEditIsReturn']">修改归还状态</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button @click="openResponsible = true" type="primary" plain size="mini"
                    v-hasPermi="['product:sampleApply:transferResponsiblePeople']">修改责任人</el-button>
            </el-col>

            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row> -->
            <el-dialog :visible.sync="openIDList" append-to-body title="补录列表" width="1500px" v-if="openIDList">
                <el-table :data="IDList">
                    <el-table-column label="样衣申请ID" align="center" prop="sampleTalentApplyId" />
                    <el-table-column label="sku" align="center" prop="sku" />
                    <el-table-column label="产品数量" align="center" prop="productNum" />
                    <el-table-column width="150" label="聚水潭售后单" align="center" prop="jstAsid" />
                    <el-table-column label="退货数量" align="center" prop="returnNum" />
                    <el-table-column label="退货状态" align="center" prop="returnStatus">
                        <template slot-scope="scope">
                            <div>
                                {{ scope.row.returnStatus | state2 }}
                            </div>
                        </template>
                    </el-table-column>

                    <!-- <el-table-column label="退货联系方式" align="center" prop="returnPhone" />
                <el-table-column label="退货申请时间" align="center" prop="createTime" width="180">
                 
                </el-table-column>
                <el-table-column label="退货收到时间" align="center" prop="returnDate" width="180">
                </el-table-column> -->

                    <el-table-column label="退货快递公司" align="center" prop="returnExpressCompany" width="120" />
                    <!-- <el-table-column label="退货快递编码" align="center" prop="returnExpressCompanyNo" width="150" /> -->
                    <el-table-column label="退货快递号" align="center" prop="returnExpressNumber" width="150" />
                </el-table>
            </el-dialog>

            <el-dialog :visible.sync="openResponsible" append-to-body title="修改责任人" width="500px" v-if="openResponsible">
                <el-form ref="formResponsible" :model="formResponsible" label-width="100px">

                    <el-form-item label="原始责任人" prop="oldResponsiblePeople">
                        <!-- <el-input v-model="formResponsible.oldResponsiblePeople" placeholder="原始责任人" /> -->
                        <el-select v-model="formResponsible.oldResponsiblePeople" clearable placeholder="原始责任人" filterable>
                            <el-option v-for="(val, key) in userList" :key="key" :label="val" :value="val" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="目标责任人" prop="newResponsiblePeople">
                        <!-- <el-input v-model="formResponsible.newResponsiblePeople" placeholder="目标责任人" /> -->
                        <el-select v-model="formResponsible.newResponsiblePeople" clearable placeholder="目标责任人" filterable>
                            <el-option v-for="(val, key) in userList" :key="key" :label="val" :value="val" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="转移原因" prop="transferReason">
                        <el-input v-model="formResponsible.transferReason" placeholder="转移原因" />
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer" style="margin-top: 50px">
                    <el-button type="primary" @click="submitResponsible">确 定</el-button>

                    <!-- <el-button @click="cancelCheck">取消</el-button> -->
                </div>
            </el-dialog>

            <!-- @row-dblclick="t"  -->
            <div ref="tableDom">
                <u-table v-loading="loading" :maxHeight="sampleApplyList.length ? tableHeight : 'auto'"
                    :data="sampleApplyList" @selection-change="handleSelectionChange" use-virtual :row-height="30"
                    :height="630" :border="false">
                    <u-table-column type="selection" width="45" align="center" />
                    <u-table-column label="ID" align="center" prop="id" />
                    <u-table-column label="内部订单" align="center" prop="bindingSoid">
                        <template slot-scope="scope" v-if="scope.row.applyStatus !== 'to_apply' &&
                            scope.row.applyStatus !== 'dingding_approval'
                            ">
                            <span>{{ scope.row.bindingSoid }}</span>
                        </template>
                    </u-table-column>
                    <!-- style="width: 180px" -->
                    <u-table-column label="部门" align="center" prop="deptName" width="150" :show-overflow-tooltip="true">
                        <!-- <template slot-scope="scope">
            <onerow :popoverInput="scope.row.deptName" />
          </template> -->
                    </u-table-column>

                    <u-table-column label="负责人" align="center" prop="responsiblePerson" width="150"
                        :show-overflow-tooltip="true" />
                    <u-table-column label="订单状态" align="center" prop="applyStatus" width="150">
                        <template slot-scope="scope">
                            <div>
                                {{ scope.row.applyStatus | state2 }}
                            </div>
                            <!-- <div v-show="scope.row.applyStatus !== 'to_apply'"
              style="color: rgb(37, 137, 255); cursor: pointer; text-decoration: underline;"
              @click="statusList(scope.row)">
              流转记录
            </div> -->
                        </template>
                    </u-table-column>
                    <!-- <u-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" />
      <u-table-column label="笔记/直播合作ID" align="center" prop="sampleTalentCooperateId" /> -->
                    <!-- ，笔记=note;直播=live -->
                    <u-table-column label="合作类型" align="center" prop="sampleTalentCooperateType">
                        <template slot-scope="scope">
                            <div>
                                {{ scope.row.sampleTalentCooperateType | state1 }}
                            </div>
                        </template>
                    </u-table-column>
                    <u-table-column label="选择品牌" align="center" prop="brand" width="110" />
                    <!-- <u-table-column label="模板ID" align="center" prop="templateId" /> -->
                    <!-- <u-table-column label="颜色ID" align="center" prop="templateSecondryId" />
      <u-table-column label="尺寸ID" align="center" prop="templateSizeId" />
      <u-table-column label="联系方式ID" align="center" prop="contactId" width="90" /> -->
                    <u-table-column label="合作款式" align="center" prop="productNo" width="110" />

                    <u-table-column label="款式主图" align="center" prop="picUrl" width="110">
                        <!-- <template slot-scope="scope">
            <image-preview :src="scope.row.picUrl" :width="50" :height="50" />
          </template> -->
                        <template #default="scope">
                            <image-preview :src="scope.row.picUrl" :width="40" :height="40" />
                            <!-- <el-popover
              effect="light"
              trigger="click"
              placement="right"
              width="auto"
              v-if="scope.row.picUrl"
            >
              <template #default>
                <img
                  :src="scope.row.picUrlFull"
                  style="width: 800px; height: 600px; object-fit: contain"
                  lazy
                />
              </template>
              <template #reference>
                <img
                  :src="scope.row.picUrlFull"
                  style="object-fit: contain; width: 40px; height: 40px"
                  lazy
                />
              </template>
            </el-popover> -->
                        </template>
                    </u-table-column>
                    <u-table-column label="商品编码" align="center" prop="productCode" width="150">
                        <template slot-scope="scope">
                            <onerow :popoverInput="scope.row.productCode" />
                        </template>
                    </u-table-column>
                    <u-table-column label="商品数量" align="center" prop="productNum" />
                    <u-table-column label="颜色属性" align="center" prop="colorProperty" width="150">
                        <template slot-scope="scope">
                            <onerow :popoverInput="scope.row.colorProperty" />
                        </template>
                    </u-table-column>
                    <u-table-column label="尺寸" align="center" prop="size">
                        <template slot-scope="scope">
                            <onerow :popoverInput="scope.row.size" />
                        </template>
                    </u-table-column>
                    <u-table-column label="季节" align="center" prop="productSeason" />
                    <u-table-column label="一级类目" align="center" prop="firstLevelColumn" width="100" />
                    <u-table-column label="二级类目" align="center" prop="secondLevelColumn" width="100" />
                    <u-table-column label="三级类目" align="center" prop="threeLevelColumn" width="160" />
                    <u-table-column width="200" label="平台名称" align="center" prop="platform" />
                    <u-table-column label="平台ID" align="center" prop="platformId" width="180" />
                    <u-table-column label="昵称" align="center" prop="xhsNickname" width="180">
                        <template slot-scope="scope">
                            <onerow :popoverInput="scope.row.xhsNickname" />
                        </template>
                    </u-table-column>

                    <u-table-column label="收件人" align="center" prop="recipient" width="180" />
                    <u-table-column label="电话" align="center" prop="phone" width="110" />
                    <u-table-column label="收件人地址" align="center" prop="address" width="200">
                        <template slot-scope="scope">
                            <mypopover :popoverInput="scope.row.address" />
                        </template>
                    </u-table-column>

                    <u-table-column label="签收时间" align="center" prop="signedTime" width="180"></u-table-column>
                    <u-table-column label="是否归还" align="center" prop="isReturn" />

                    <u-table-column width="200" label="归还补充说明" align="center" prop="isReturnRemark">
                        <template slot-scope="scope">
                            <mypopover :popoverInput="scope.row.isReturnRemark" />
                        </template>
                    </u-table-column>
                    <u-table-column width="200" label="最终归还状态" align="center" prop="finalIsReturn" />
                    <u-table-column width="200" label="最终归还说明" align="center" prop="finalIsReturnRemark" />
                    <u-table-column width="200" label="最终归还证明" align="center" prop="finalIsReturnPicUrl">
                        <template #default="scope">
                            <image-preview :src="scope.row.finalIsReturnPicUrl" :width="40" :height="40" />
                        </template>
                    </u-table-column>
                    <u-table-column label="最终归还修改时间" align="center" prop="finalIsReturnUpdateTime"
                        width="180"></u-table-column>
                    <u-table-column label="发货备注" align="center" prop="innerApplyReason">
                        <template slot-scope="scope">
                            <mypopover :popoverInput="scope.row.innerApplyReason" />
                        </template>
                    </u-table-column>
                    <u-table-column width="200" label="直播间名称" align="center" prop="liveRoomName" />
                    <u-table-column label="申请时间" align="center" prop="createTime" width="180" />
                    <u-table-column label="快递公司" align="center" prop="expressCompany" />
                    <u-table-column label="快递单号" align="center" prop="expressNumber" width="150">
                        <template slot-scope="scope">
                            <el-popover trigger="hover" placement="bottom" width="300">
                                <el-input v-model="scope.row.expressNumber" :min-height="192" type="textarea"
                                    :autosize="{ minRows: 2, maxRows: 24 }" :style="{ width: '100%' }" :disabled="true" />
                                <div slot="reference">
                                    <span class="textname">{{ scope.row.expressNumber }} </span>
                                </div>
                            </el-popover>
                        </template>
                    </u-table-column>
                    <u-table-column label="发货时间" align="center" prop="deliveryTime" width="180">
                        <!-- <template slot-scope="scope">
            <span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
          </template> -->
                    </u-table-column>
                    <u-table-column label="申请人" align="center" prop="buyerAccount" width="250"
                        :show-overflow-tooltip="true">
                        <!-- <template slot-scope="scope">
            <onerow :popoverInput="scope.row.buyerAccount" />
          </template> -->
                    </u-table-column>
                    <u-table-column label="待退货数量" align="center" prop="toReturnNum" />
                    <u-table-column label="退货中数量" align="center" prop="returningNum" />
                    <u-table-column label="已退回数量" align="center" prop="returnedNum" />
                    <!-- <u-table-column label="退货情况" align="center" prop="">
                    <template slot-scope="scope">
                        <div style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
              " @click="getlistSampleReturn(scope.row)">
                            退货信息
                        </div>
                        <el-button size="mini" @click="goto(scope.row)">
                            退货数据
                        </el-button>
                    </template>
                </u-table-column> -->
                    <!-- 
         
          
          <u-table-column label="固话" align="center" prop="fixedLine" />
        <u-table-column label="卖家备注" align="center" prop="remark" />
        <u-table-column label="线上订单号" align="center" prop="onlineNumber" width="130" />
        <u-table-column label="子订单编号" align="center" prop="subOrderNumber" width="130" />

        <u-table-column label="支付单号" align="center" prop="paymentOrderNumber" />
        <u-table-column label="付款方式" align="center" prop="paymentMethod" />
        <u-table-column label="运费" align="center" prop="freight" />
        <u-table-column label="应付金额" align="center" prop="payableAmount" />

        <u-table-column label="邮编" align="center" prop="zipCode" />

        
        <u-table-column label="商品名称" align="center" prop="productName" />
        <u-table-column label="商品单价" align="center" prop="productPricing" />
        <u-table-column label="商品成本" align="center" prop="productCost" />
        <u-table-column label="结算金额" align="center" prop="productSettlment" />
        <u-table-column label="生产批次" align="center" prop="productBatch" />
        <u-table-column label="生产日期" align="center" prop="manufactureDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.manufactureDate, '{y}-{m}-{d}') }}</span>
          </template>
        </u-table-column>
        <u-table-column label="快递公司" align="center" prop="expressCompany" />
        <u-table-column label="快递单号" align="center" prop="expressNumber" />
        <u-table-column label="发货时间" align="center" prop="deliveryTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
          </template>
        </u-table-column>
        <u-table-column label="业务员" align="center" prop="salesman" />
        <u-table-column label="便签|线下备注" align="center" prop="offlineNotes" width="130" />
        
        <u-table-column label="退货电话" align="center" prop="returnPhone" />
        <u-table-column label="退货收件人" align="center" prop="returnRecipient" width="100" />
        <u-table-column label="退货收件人地址" align="center" prop="returnAddress" width="130">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              
              <el-input v-model="scope.row.returnAddress" :min-height="192" type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }" :style="{ width: '100%' }" :disabled="true" />
              <div slot="reference">
                <span class="textname">{{ scope.row.returnAddress }}
                </span>
              </div>
            </el-popover>
          </template>
        </u-table-column> -->

                    <!-- <u-table-column label="逻辑删除;0=未删除；1=已删除" align="center" prop="isDelete" /> -->
                    <!-- <u-table-column label="操作" align="center" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                            v-hasPermi="['product:sampleApply:edit']">修改</el-button>
                        <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                            v-hasPermi="['product:sampleApply:remove']">删除</el-button>
                    </template>
                </u-table-column> -->
                </u-table>
            </div>

            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize" :page-sizes="[10, 30, 50, 100, 120, 150, 200]" @pagination="pageList" />
        </el-card>
        <el-card>
            <div slot="header" style="display: flex; justify-content: space-between">
                <span style="font-size: 16px"><i class="el-icon-collection"></i>STEP2:填写售后单列表 <el-button type="primary"
                        size="mini" @click="addLibraryIdList">新增</el-button></span>
            </div>
            <el-form ref="form" :model="formData" label-position="top">
                <div>
                    <div class="flex_row" style="display: flex; flex-direction: row">
                        <div v-for="(item, index) in formData.libraryIdList" :key="index" class="fx_5">
                            <el-form-item style="display: flex; flex-direction: row">
                                <el-input style="width: 200px;" v-model="item.id" placeholder="售后单"></el-input>
                                <!-- <el-select v-model="item.id" placeholder="品类展示" filterable @change="keywordListlength"
                                    allow-create default-first-option remote :remote-method="getselectKeyWordList">
                                    <el-option v-for="libraryItem in libraryOptions" :key="libraryItem" :label="libraryItem"
                                        :value="libraryItem">
                                    </el-option>
                                </el-select> -->

                                <span v-if="formData.libraryIdList.length > 1" @click="delRow(item, index)">
                                    <el-button type="danger" size="mini" class="el-icon-delete"></el-button>
                                </span>
                                <span v-if="index !== formData.libraryIdList.length - 1">
                                    VS
                                </span>
                            </el-form-item>
                        </div>
                    </div>
                </div>
            </el-form>
            <!-- <el-input style="width: 600px;" v-model="asidList" placeholder="填写售后单" /> -->
        </el-card>
        <div style="width: 60px; margin: 0 auto">
            <el-button style="margin-right: 50px" type="primary" @click="handleComparison">确 定</el-button>
            <!-- <el-button @click="cancel">取 消</el-button> -->
        </div>
        <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
        <el-dialog title="流转记录" :visible.sync="openReturnList" width="70%" append-to-body>
            <el-table :data="sampleReturnList">
                <el-table-column label="样衣申请ID" align="center" prop="sampleTalentApplyId" />
                <el-table-column label="sku" align="center" prop="sku" />
                <el-table-column label="产品数量" align="center" prop="productNum" />
                <el-table-column width="150" label="聚水潭售后单" align="center" prop="jstAsid" />
                <el-table-column label="退货数量" align="center" prop="returnNum" />
                <el-table-column label="退货状态" align="center" prop="returnStatus">
                    <template slot-scope="scope">
                        <div>
                            {{ scope.row.returnStatus | state2 }}
                        </div>
                    </template>
                </el-table-column>

                <!-- <el-table-column label="退货联系方式" align="center" prop="returnPhone" />
                <el-table-column label="退货申请时间" align="center" prop="createTime" width="180">
                 
                </el-table-column>
                <el-table-column label="退货收到时间" align="center" prop="returnDate" width="180">
                </el-table-column> -->

                <el-table-column label="退货快递公司" align="center" prop="returnExpressCompany" width="120" />
                <!-- <el-table-column label="退货快递编码" align="center" prop="returnExpressCompanyNo" width="150" /> -->
                <el-table-column label="退货快递号" align="center" prop="returnExpressNumber" width="150" />
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button @click="handleselectReturnRecordList">查询补录列表</el-button>
                <el-button type="primary" @click="handleReturnRecord">补 录</el-button>
            </div>
        </el-dialog>

        <!-- 添加或修改样衣申请记录对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body v-if="open">
            <div class="el-dialog-div">
                <el-form ref="form" :model="form" :rules="rules" label-width="100px">
                    <el-col :span="10">
                        <!-- <el-form-item label="达人信息表ID" prop="sampleTalentInfoId">
              <el-input v-model="form.sampleTalentInfoId" placeholder="达人信息表ID" />
            </el-form-item>
            <el-form-item label="笔记/直播合作ID" prop="sampleTalentCooperateId">
              <el-input v-model="form.sampleTalentCooperateId" placeholder="笔记/直播合作ID" />
            </el-form-item> -->
                        <!-- <el-form-item label="模板ID" prop="templateId">
              <el-input v-model="form.templateId" placeholder="模板ID" />
            </el-form-item> -->
                        <!-- <el-form-item label="颜色ID" prop="templateSecondryId">
              <el-input v-model="form.templateSecondryId" placeholder="颜色ID" />
            </el-form-item>
            <el-form-item label="尺寸ID" prop="templateSizeId">
              <el-input v-model="form.templateSizeId" placeholder="尺寸ID" />
            </el-form-item>
            <el-form-item label="联系方式ID" prop="contactId">
              <el-input v-model="form.contactId" placeholder="联系方式ID" />
            </el-form-item> -->

                        <el-form-item label="合作款式" prop="productNo">
                            <!-- <el-input v-model="form.productNo" placeholder="请输入货号" /> -->
                            <el-select :disabled="to_sumbit" v-model="form.productNo" clearable filterable remote
                                :remote-method="getDatas" :loading="loading" placeholder="请选择合作款式">
                                <el-option v-for="item in options" :key="item" :label="item" :value="item">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="颜色属性" prop="colorProperty">
                            <!-- <el-input v-model="form.colorProperty" placeholder="请输入颜色属性" :loading="loading"/> -->
                            <el-select :disabled="to_sumbit" @focus="onFocus" ref="selectRef" v-model="form.colorProperty"
                                clearable filterable remote :remote-method="getData" placeholder="请选择颜色属性">
                                <el-option v-for="item in ColorLike" :key="item" :label="item" :value="item">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="尺寸" prop="size">
                            <el-select :disabled="to_sumbit" @focus="onFocus" v-model="form.size" clearable filterable
                                remote :remote-method="getSize" placeholder="请选择尺寸" @change="testSize">
                                <el-option v-for="item in sizeList" :key="item.id" :label="item.size" :value="item.size">
                                </el-option>
                            </el-select>
                            <!-- <el-select v-model="form.size" placeholder="请选择尺寸" clearable>
                <el-option v-for="dict in dict.type.sys_product_size" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select> -->
                        </el-form-item>
                        <el-form-item label="商品数量" prop="productNum">
                            <el-input :disabled="to_sumbit" v-model="form.productNum" placeholder="商品数量" type="number"
                                oninput="value=value.replace(/^0|[^0-9]/g,'')" />
                            <el-button :disabled="to_sumbit" type="primary" size="mini" @click="getinventory">查询</el-button>
                            <span style="color: red">当前库存量：{{ num }}</span>
                        </el-form-item>
                        <!-- <el-form-item label="卖家备注" prop="remark">
              <el-input v-model="form.remark" placeholder="卖家备注" />
            </el-form-item> -->
                        <!-- <el-form-item label="线上订单号" prop="onlineNumber">
              <el-input v-model="form.onlineNumber" placeholder="线上订单号" />
            </el-form-item>
            <el-form-item label="子订单编号" prop="subOrderNumber">
              <el-input v-model="form.subOrderNumber" placeholder="子订单编号" />
            </el-form-item> -->

                        <!-- <el-form-item label="申请人" prop="buyerAccount">
              <el-input v-model="form.buyerAccount" placeholder="申请人" />
            </el-form-item> -->

                        <!-- <el-form-item label="支付单号" prop="paymentOrderNumber">
              <el-input v-model="form.paymentOrderNumber" placeholder="支付单号" />
            </el-form-item>
            <el-form-item label="付款方式" prop="paymentMethod">
              <el-input v-model="form.paymentMethod" placeholder="付款方式" />
            </el-form-item>
            <el-form-item label="运费" prop="freight">
              <el-input v-model="form.freight" placeholder="运费" />
            </el-form-item>
            <el-form-item label="应付金额" prop="payableAmount">
              <el-input v-model="form.payableAmount" placeholder="应付金额" />
            </el-form-item> -->
                        <el-form-item label="快递公司" prop="expressCompany">
                            <!-- <el-input v-model="form.expressCompany" placeholder="快递公司" /> -->
                            <el-select :disabled="to_sumbit" v-model="form.expressCompany" placeholder="请选择快递公司" clearable
                                filterable>
                                <el-option v-for="dict in dict.type.sys_jst_sample_sf" :key="dict.label" :label="dict.label"
                                    :value="dict.label" />
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否归还" prop="isReturn">
                            <el-select :disabled="to_sumbit" v-model="form.isReturn" placeholder="请选择是否归还" clearable
                                filterable>
                                <el-option v-for="dict in dict.type.sys_one_zero" :key="dict.value" :label="dict.label"
                                    :value="dict.label" />
                            </el-select>
                        </el-form-item>
                        <el-form-item label="归还补充说明" prop="isReturnRemark">
                            <el-input v-model="form.isReturnRemark" placeholder="归还补充说明" type="textarea"
                                :autosize="{ minRows: 2, maxRows: 12 }" :style="{ width: '100%' }" />
                            <!-- <el-select v-model="formVFU.isReturn" placeholder="请选择是否归还" clearable filterable>
      <el-option v-for="dict in dict.type.sys_one_zero" :key="dict.value" :label="dict.label" :value="dict.label" />
    </el-select> -->
                        </el-form-item>
                        <el-form-item label="发货备注" prop="innerApplyReason">
                            <el-input :disabled="to_sumbit" v-model="form.innerApplyReason" placeholder="发货备注"
                                type="textarea" :autosize="{ minRows: 2, maxRows: 12 }" :style="{ width: '100%' }" />
                            <!-- <el-select v-model="formVFU.isReturn" placeholder="请选择是否归还" clearable filterable>
      <el-option v-for="dict in dict.type.sys_one_zero" :key="dict.value" :label="dict.label" :value="dict.label" />
    </el-select> -->
                        </el-form-item>
                    </el-col>
                    <el-col :span="1">
                        <el-form-item></el-form-item>
                    </el-col>
                    <el-col :span="13">
                        <el-form-item label="收件人" prop="recipient">
                            <el-input :disabled="to_sumbit" v-model="form.recipient" placeholder="请输入收件人" />
                        </el-form-item>
                        <el-form-item label="电话" prop="phone">
                            <el-input :disabled="to_sumbit" v-model="form.phone" placeholder="请输入电话" />
                        </el-form-item>

                        <el-form-item label="所在区域" prop="">
                            <el-row>
                                <!-- <el-select v-model="form.receiverState" placeholder="请选择" @change="selectProvimce" style="width:130px">
              <el-option v-for="(item, index) of provincearr" :key="index" :label="item.name"
                :value="item.name"></el-option>
            </el-select>
            <el-select v-model="form.receiverCity" placeholder="请选择" @change="selectcity" style="width:130px">
              <el-option v-for="(item, index) of cityarr" :key="index" :label="item.name" :value="item.name"></el-option>
            </el-select>
            <el-select placeholder="请选择" v-model="form.receiverDistrict" style="width:150px">
              <el-option v-for="(item, index) of regionarr" :key="index" :label="item.name"
                :value="item.name"></el-option>
            </el-select> -->
                                <el-select :disabled="to_sumbit" v-model="form.receiverState" clearable placeholder="省"
                                    @change="seletekey($event, 'province')" style="width: 130px">
                                    <el-option v-for="(val, key) in provinces" :key="key" :label="val" :value="val" />
                                </el-select>
                                <el-select :disabled="to_sumbit" v-model="form.receiverCity" clearable placeholder="市"
                                    @change="seletekey($event, 'city')" style="width: 130px">
                                    <el-option v-for="(val, key) in citys" :key="key" :label="val" :value="val" />
                                </el-select>
                                <el-select :disabled="to_sumbit" v-model="form.receiverDistrict" clearable placeholder="县区"
                                    @change="seletekey($event, 'area')" style="width: 135px" filterable allow-create>
                                    <el-option v-for="(val, key) in areas" :key="key" :label="val" :value="val" />
                                </el-select>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="收件人地址" prop="address">
                            <el-input :disabled="to_sumbit" v-model="form.address" placeholder="请输入收件人地址"
                                style="width: 300px" />
                        </el-form-item>

                        <el-form-item label="直播间名称" prop="liveRoomName">
                            <!-- <el-input
                :disabled="to_sumbit"
                v-model="form.liveRoomName"
                placeholder="请输入直播间名称"
              /> -->
                            <el-select v-model="form.liveRoomName" clearable placeholder="直播间名称" filterable>
                                <el-option v-for="(val, key) in liveroomList" :key="key" :label="val.liveStreamRoom"
                                    :value="val.liveStreamRoom" />
                            </el-select>
                        </el-form-item>
                        <el-form-item label="文本粘贴" prop="">
                            <el-input :disabled="to_sumbit" v-model="demo" type="textarea"
                                :autosize="{ minRows: 2, maxRows: 10 }" placeholder="省市区地址、姓名、电话11位用空格分开!!"
                                style="width: 350px"></el-input>
                            <el-button :disabled="to_sumbit" type="primary" size="mini" @click="addText">识别</el-button>
                            <!-- <el-input v-model="sampleTalentPay.platform" placeholder="请输入平台名称" /> -->
                        </el-form-item>
                        <!-- <el-form-item label="款式主图" prop="styleMainImage">
              <image-upload v-model="form.styleMainImage" />
            </el-form-item> -->
                        <!-- <el-form-item label="内部订单号" prop="bindingSoid">
              <el-input v-model="form.bindingSoid" placeholder="内部订单号" />
            </el-form-item> -->

                        <!-- <el-form-item label="商品名称" prop="productName">
              <el-input v-model="form.productName" placeholder="商品名称" />
            </el-form-item>
            <el-form-item label="商品单价" prop="productPricing">
              <el-input v-model="form.productPricing" placeholder="商品单价" />
            </el-form-item>
            <el-form-item label="商品成本" prop="productCost">
              <el-input v-model="form.productCost" placeholder="商品成本" />
            </el-form-item>
            <el-form-item label="结算金额" prop="productSettlment">
              <el-input v-model="form.productSettlment" placeholder="结算金额" />
            </el-form-item>
            <el-form-item label="生产批次" prop="productBatch">
              <el-input v-model="form.productBatch" placeholder="生产批次" />
            </el-form-item>
            <el-form-item label="生产日期" prop="manufactureDate">
              <el-date-picker clearable v-model="form.manufactureDate" type="date" value-format="yyyy-MM-dd"
                placeholder="请选择生产日期">
              </el-date-picker>
            </el-form-item> -->

                        <!-- <el-form-item label="快递单号" prop="expressNumber">
              <el-input v-model="form.expressNumber" placeholder="快递单号" />
            </el-form-item>
            <el-form-item label="发货时间" prop="deliveryTime">
              <el-date-picker clearable v-model="form.deliveryTime" type="date" value-format="yyyy-MM-dd"
                placeholder="请选择发货时间">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="业务员" prop="salesman">
              <el-input v-model="form.salesman" placeholder="业务员" />
            </el-form-item> -->

                        <!-- <el-form-item label="逻辑删除;0=未删除；1=已删除" prop="isDelete">
          <el-input v-model="form.isDelete" placeholder="逻辑删除;0=未删除；1=已删除" />
        </el-form-item> -->
                    </el-col>
                    <!-- <el-col :span="1">
            <el-form-item></el-form-item>
          </el-col>
          <el-col :span="7"> </el-col> -->

                    <!-- <el-form-item label="便签|线下备注" prop="offlineNotes">
              <el-input v-model="form.offlineNotes" placeholder="便签|线下备注" />
            </el-form-item>
            <el-form-item label="固话" prop="fixedLine">
              <el-input v-model="form.fixedLine" placeholder="固话" />
            </el-form-item>
            <el-form-item label="邮编" prop="zipCode">
              <el-input v-model="form.zipCode" placeholder="邮编" />
            </el-form-item>
            <el-form-item label="退货电话" prop="returnPhone">
              <el-input v-model="form.returnPhone" placeholder="退货电话" />
            </el-form-item>
            <el-form-item label="退货收件人" prop="returnRecipient">
              <el-input v-model="form.returnRecipient" placeholder="退货收件人" />
            </el-form-item>
            <el-form-item label="退货收件人地址" prop="returnAddress">
              <el-input v-model="form.returnAddress" placeholder="退货收件人地址" />
            </el-form-item>
            <el-form-item label="退货联系方式" prop="returnContactId">
              <el-input v-model="form.returnContactId" placeholder="退货联系方式" />
            </el-form-item>
            <el-form-item label="退货取件码" prop="returnExpressPickupCode">
              <el-input v-model="form.returnExpressPickupCode" placeholder="退货取件码" />
            </el-form-item>
            <el-form-item label="退货订单号" prop="returnExpressNumber">
              <el-input v-model="form.returnExpressNumber" placeholder="退货订单号" />
            </el-form-item>
            <el-form-item label="退货时间" prop="returnDate">
              <el-date-picker clearable v-model="form.returnDate" type="date" value-format="yyyy-MM-dd"
                placeholder="请选择退货时间">
              </el-date-picker>
            </el-form-item> -->
                </el-form>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>

        <el-dialog :visible.sync="VisibleCheck" append-to-body title="审批" width="500px" v-if="VisibleCheck">
            <el-form ref="formCheck" :model="formCheck" :rules="rules" label-width="100px">
                <el-form-item label="是否同意" prop="isAgree">
                    <!-- <el-input v-model="formCheck.isAgree" placeholder="是否同意" /> -->
                    <!-- <el-button type="primary" @click="submitTrue">确 定</el-button>
        <el-button @click="submitFalse">取 消</el-button> -->
                    <el-radio-group v-model="formCheck.isAgree" size="small" fill="#66b1ff">
                        <el-radio :label="'true'">同意</el-radio>
                        <el-radio :label="'false'">不同意</el-radio>
                        <!-- <el-radio :label="null">所有</el-radio> -->
                    </el-radio-group>
                </el-form-item>
                <!-- <el-form-item label="截图链接" prop=" checkPic">
          <el-input v-model="formCheck.checkPic" placeholder="截图链接" />
        </el-form-item> -->
                <el-form-item label="审批意见" prop="reason">
                    <el-input v-model="formCheck.reason" placeholder="审批意见" />
                </el-form-item>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="formCheck.remark" placeholder="备注" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="margin-top: 50px">
                <el-button type="primary" @click="submitCheck">确 定</el-button>

                <el-button @click="cancelCheck">取消</el-button>
            </div>
        </el-dialog>

        <el-dialog :visible.sync="Visibleapply" append-to-body title="申请" width="500px" v-if="Visibleapply">
            <el-form ref="formApply" :model="formApply" :rules="rules" label-width="100px">
                <el-form-item label="申请理由" prop="remark">
                    <!-- <el-input v-model="formApply.remark" placeholder="申请理由" /> -->
                    <el-input v-model="formApply.remark" placeholder="请输入申请理由" type="textarea"
                        :autosize="{ minRows: 2, maxRows: 12 }" :style="{ width: '100%' }" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="margin-top: 50px">
                <el-button type="primary" @click="handlecheckAfterSaleNoInfoReq">确 定</el-button>

                <el-button @click="cancelApply">取消</el-button>
            </div>
        </el-dialog>
        <el-dialog title="低库存明细如下：" :visible.sync="openInventory" width="50%" append-to-body v-if="openInventory">
            <div class="el-dialog-div">
                <el-table :height="heightInventory" :data="msgInventory">
                    <el-table-column label="合作款式" align="center" prop="productNo" />
                    <el-table-column label="商品数量" align="center" prop="productNum" />
                </el-table>
            </div>
            <div slot="footer" class="dialog-footer" style="margin-top: 50px">
                <!-- <div style="text-align: center; margin-top: 30px">
          <strong> 是否仍然申请/返回修改？ </strong>
        </div> -->
                <el-button type="primary" @click="submitApply">仍然申请</el-button>

                <el-button @click="closeInventory">返回修改</el-button>
            </div>
        </el-dialog>
        <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
        <el-dialog title="流转记录" :visible.sync="openApply" append-to-body>
            <el-table :data="ApplyList">
                <!-- <el-table-column type="selection" width="55" align="center" /> -->
                <!-- <el-table-column label="联系ID" align="center" prop="id" />
      <el-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" /> -->
                <el-table-column label="办理节点" align="center" prop="nodeName" />
                <el-table-column label="办理人" align="center" prop="userName" />
                <el-table-column label="办理时间" align="center" prop="createTime" />
                <el-table-column label="审批意见" align="center" prop="reason" />
            </el-table>
        </el-dialog>



        <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
        <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" append-to-body v-if="dialogVisible">
            <el-form label-width="150px">
                <el-form-item label="导入模板下载" prop="file">
                    <el-button size="mini" @click="downLoadFile">
                        导入模板下载
                    </el-button>
                </el-form-item>
                <el-form-item label="导入文件" prop="file">
                    <el-upload :action="Upload.url" :headers="Upload.headers" :limit="limit" :on-exceed="handleExceed"
                        :on-success="handlePictureSuccessPic" :before-upload="beforeAvatarUpload" :file-list="fileLi"
                        :on-change="changeFile1">
                        <el-button size="small" type="primary">导入文件</el-button>

                        <!-- <i class="el-icon-plus"></i> -->
                    </el-upload>
                </el-form-item>
            </el-form>
        </el-dialog>

        <el-dialog :visible.sync="openmsg" width="50%" append-to-body v-show="openmsg">
            <div class="el-dialog-div">
                <!-- {{  }} -->
                <el-input v-model="this.msg" type="textarea" :autosize="{ minRows: 2, maxRows: 200 }"
                    :style="{ width: '100%' }" :disabled="true" />
            </div>
        </el-dialog>

        <el-dialog :visible.sync="openbatchReturn" append-to-body title="修改归还状态" width="600px" v-if="openbatchReturn">
            <el-form label-width="120px">
                <el-card style="margin-bottom: 16px">
                    <div slot="header">
                        <span><i class="el-icon-collection"></i> 单条修改</span>
                    </div>
                    <el-form-item label="最终归还状态" prop="finalIsReturn">
                        <el-radio-group v-model="finalIsReturn" size="small" fill="#66b1ff">
                            <el-radio :label="'是'">归还</el-radio>
                            <el-radio :label="'否'">不归还</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <!-- <el-form-item label="最终归还时间" prop="finalIsReturnUpdateTime">
          
          <el-date-picker
            clearable
            v-model="finalIsReturnUpdateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="最终归还时间"
          >
          </el-date-picker>
        </el-form-item> -->
                    <el-form-item label="最终归还说明" prop="finalIsReturnRemark">
                        <el-input v-model="finalIsReturnRemark" placeholder="最终归还说明" />
                    </el-form-item>

                    <el-form-item label="证明" prop="finalIsReturn">
                        <el-upload ref="uploadlogourl" :action="imgUpload.url" :headers="imgUpload.headers"
                            list-type="picture-card" :on-change="changelogourl" :file-list="filelogourl" multiple
                            :on-success="uploadlogourl" :on-remove="Removelogourl">
                            <i class="el-icon-plus"></i>
                        </el-upload>
                        <div id="preview" @paste="handlelogourl">
                            <span><i class="el-icon-s-opportunity" style="color: #fb894c"></i>点击此处 将图片按Ctrl+V 粘贴至此处</span>
                        </div>
                    </el-form-item>
                </el-card>
                <el-card>
                    <div slot="header" style="margin-bottom: 10px">
                        <span><i class="el-icon-collection"></i> 批量修改</span>
                    </div>
                    <el-form-item label="模板下载" prop="finalIsReturn">
                        <el-button size="mini" @click="downLoadTemplateFile">
                            修改归还状态导入模板下载
                        </el-button>
                    </el-form-item>
                    <el-form-item label="批量修改状态导入" prop="finalIsReturnRemark" label-width="130px">
                        <el-upload :action="newUpload.url" :headers="newUpload.headers" :limit="limit"
                            :on-exceed="handleExceed" :on-success="handlenewUploadSuccessDaoru"
                            :before-upload="beforeAvatarUpload" :file-list="fileLi" :on-change="changeFile1">
                            <el-button size="small" type="primary">导入文件</el-button>
                        </el-upload>
                    </el-form-item>
                </el-card>
            </el-form>
            <div slot="footer" class="dialog-footer" style="margin-top: 20px">
                <el-button type="primary" @click="submitbatchReturn">确 定</el-button>
            </div>
        </el-dialog>

        <el-dialog :visible.sync="Visiblereturn" append-to-body title="发起退货" width="500px" v-if="Visiblereturn">
            <el-form ref="fReturn" :model="fReturn" :rules="rules" label-width="110px" :inline="true">
                <!-- <el-form-item label="寄出方式" prop="returnAddress">
          <el-radio-group
            v-model="Status"
            size="small"
            fill="#66b1ff"
            @change="changeStatus"
          >
            <el-radio :label="0">上门取件</el-radio>
            <el-radio :label="1">自行寄出</el-radio>
          </el-radio-group>
        </el-form-item> -->

                <el-form-item label="取件地址" prop="returnAddress" v-show="noSelf">
                    <el-select v-model="fReturn.returnContactId">
                        <el-option v-for="item in optionsContact" :key="item.id"
                            :label="`${item.phone},${item.recipient},${item.receiverState}${item.receiverCity}${item.receiverDistrict}${item.address}`"
                            :value="item.id" />
                    </el-select>
                </el-form-item>
                <el-form-item label="仓库地址" prop="returnAddress" v-show="noSelf">
                    <!--@focus="onFocus" <el-input v-model="fReturn.returnAddress" placeholder="客户收件人地址" /> -->
                    <el-select v-model="fReturn.sampleReturnAddressId" clearable filterable remote @change="changeAddress">
                        <el-option v-for="item in returnAddressList" :key="item.id"
                            :label="`${item.returnName},${item.returnPhone},${item.returnAddress}`" :value="item.id" />
                    </el-select>
                </el-form-item>
                <el-form-item label="预约日期" prop="pickupDayType" v-show="noSelf">
                    <!-- <el-date-picker clearable v-model="fReturn.returnDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择预约时间">
          </el-date-picker> -->
                    <el-select v-model="fReturn.pickupDayType" placeholder="请选择预约时间" clearable>
                        <el-option v-for="dict in dict.type.sys_sample_day" :key="dict.value" :label="dict.label"
                            :value="dict.label" />
                    </el-select>
                </el-form-item>

                <el-form-item label="上门时间" prop="returnDate" v-show="noSelf">
                    <!-- <el-date-picker clearable v-model="fReturn.returnDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择上门时间">
          </el-date-picker> -->
                    <el-select v-model="returnDate" placeholder="请选择上门时间" clearable>
                        <el-option v-for="dict in dict.type.sys_sample_time" :key="dict.value" :label="dict.label"
                            :value="dict.label" />
                    </el-select>
                </el-form-item>
                <el-form-item label="快递公司" prop="expressCompany">
                    <!-- <el-input v-model="Contact.expressCompany" placeholder="快递公司" /> -->
                    <el-select v-model="fReturn.expressCompany" placeholder="请选择快递公司" clearable filterable v-if="noSelf">
                        <el-option v-for="dict in dict.type.sys_sample_sf" :key="dict.value" :label="dict.label"
                            :value="dict.label" />
                    </el-select>
                    <el-select v-model="fReturn.expressCompany" placeholder="请选择快递公司" clearable filterable v-if="!noSelf">
                        <el-option v-for="dict in dict.type.sys_jst_sample_sf" :key="dict.label" :label="dict.label"
                            :value="dict.label" />
                    </el-select>
                </el-form-item>
                <el-form-item label="退货快递单号" prop="address" v-show="!noSelf">
                    <!-- <el-select v-model="formSelf.id">
      <el-option v-for="item in optionsContact" :key="item.id" :label="item.address" :value="item.id" />
    </el-select> -->
                    <el-input v-model="fReturn.expressNumber" placeholder="请输入退货快递单号"
                        oninput="value=value.replace(/[^0-9A-Za-z]/g,'')" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="margin-top: 50px">
                <!-- <el-button type="primary" @click="submitReturn" v-show="noSelf"
          >确 定</el-button
        > -->
                <el-button type="primary" @click="submitSelf" v-show="!noSelf">确 定</el-button>
                <!-- <el-button @click="canNew">取 消</el-button> -->
                <el-button @click="Return">取消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import IDList from "./IDList.vue";
import AddressParse from "address-parse";
import {
    listContact,
    getContact,
    delContact,
    addContact,
    updateContact,
} from "@/api/sample/contact";
import {
    listReturnAddress,
    getReturnAddress,
    delReturnAddress,
    addReturnAddress,
    updateReturnAddress,
    search,
    returnApplyByApplyID,
} from "@/api/sample/returnAddress";
import { Notification, MessageBox, Message, Loading } from "element-ui";
// import { tansParams, blobValidate } from "@/utils/ruoyi";
// import axios from "axios";
import { inventory } from "@/api/sample/sample";
import {
    listSampleReturn,
    getSampleReturn,
    delSampleReturn,
    addSampleReturn,
    updateSampleReturn,
    selectReturnRecordList,
    additionalReturnRecord
} from "@/api/sample/sampleReturn";
// import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
// import { getInfo } from "@/api/login.js";
import {
    listSecondry,
    getSecondry,
    delSecondry,
    addSecondry,
    updateSecondry,
    getInfoByName,
    productNoColorLike,
    listAll,
} from "@/api/product/secondry";
import {
    listTemplate,
    getTemplate,
    delTemplate,
    addTemplate,
    updateTemplate,
    addTemplateAndSecondry,
    addProNoColorSize,
    productNoLike,
} from "@/api/product/template";
import {
    listSampleApply,
    getSampleApply,
    delSampleApply,
    addSampleApply,
    updateSampleApply,
    addApply,
    returnApply,
    selectSampleTalentApplyToDo,
    SampleTalentApplyCheck,
    startApplyFlow,
    selectFlowInstanceRecordListExt,
    selectMySampleTalentApply,
    uploadIst,
    deptlistSampleApply,
    alllistSampleApply,
    checkInventory,
    checkDingdingStatus,
    startApplyExcel,
    checkAfterSaleNoInfoReq,
    checkPackageStatus,
    batchEditIsReturn,
    isValidData,
    selectuserList,
    transferResponsiblePeople,
    dataComparison
} from "@/api/sample/sampleApply";
import {
    listLiveroom,
    getLiveroom,
    delLiveroom,
    addLiveroom,
    updateLiveroom,
} from "@/api/sample/liveroom";
//--------导入token
import { getToken } from "@/utils/auth";
import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from "@/plugins/cache";
import { saveAs } from "file-saver";
//数据获取
import { pcaa } from "area-data";
import { getInfo } from "@/api/login.js";
import axios from "axios";
import { EXPORT_EXCEL } from "./xlsx";
import { downLoadTemplate } from "@/api/data/template";
export default {
    name: "SampleApply",
    dicts: [
        "sys_product_qudao",
        "sys_one_zero",
        "sys_product_size",
        "sys_sample_sf",
        "sys_jst_sample_sf",
        "sys_product_pp",
        "sys_product_jijie",
        "sys_product_secondary",
        "sys_product_cycle",
        "sys_product_pl",
        "sys_final_return",
    ],
    components: {
        IDList,
    },
    data() {
        return {
            //多选品类
            formData: {
                libraryIdList: [{ id: "" }],
            },
            libraryOptions: [
                // { value: "1", label: "库位1" },
                // { value: "2", label: "库位2" },
                // { value: "3", label: "库位3" },
                // { value: "4", label: "库位4" },
                // { value: "5", label: "库位5" },
                // { value: "6", label: "库位6" },
            ], // 库存名称列表
            asidList: 911679322,
            openIDList: false,
            IDList: [],
            userList: [],
            openResponsible: false,
            formResponsible: {},
            //最终归还时间
            finalIsReturnUpdateTime: "",
            //最终归还说明
            finalIsReturnRemark: "",
            //最终归还图片
            finalIsReturnPicUrl: "",
            filelogourl: [],
            upload_logourl: [], //提交的图片数组
            //直播间名称
            liveroomList: [],
            finalIsReturn: "是",
            openbatchReturn: false,
            //检查库存
            heightInventory: 500,
            openInventory: false,
            msgInventory: [],

            //当前操作用户角色
            roles: [],
            //文本粘贴
            demo: "",
            //省市区
            pcaaData: pcaa,
            // 区域数据
            provinces: pcaa["86"],
            citys: [],
            areas: [],

            //达人收件信息
            productNooptions: [],
            optionsContact: [],
            formVFU: {
                isReturn: "是",

                expressCompany: "中通快递",
            },
            //选中get
            sampleTalentInfoId: [],
            //上门取件
            Visiblereturn: false,
            fReturn: {
                pickupDayType: "今天",
                expressCompany: "中通快递",
            },
            returnAddressList: [],
            //上门时间
            returnDate: "15:00-17:00",
            //上门取件or自行寄出
            Status: 0,
            noSelf: false,
            VisibleSelf: false,
            // 导入
            openmsg: false,
            msg: "",
            fileLi: [],
            dialogVisible: false,
            limit: 2,
            Upload: {
                // 设置上传的请求头部
                headers: {
                    header: { responseType: "blob" },

                    Authorization: "Bearer " + getToken(),
                },
                // 图片上传的方法地址:
                url:
                    process.env.VUE_APP_BASE_API +
                    "/product/sampleApply/importSampleTalentApply",
            },
            newUpload: {
                // 设置上传的请求头部
                headers: {
                    header: { responseType: "blob" },

                    Authorization: "Bearer " + getToken(),
                },
                // 图片上传的方法地址:
                url:
                    process.env.VUE_APP_BASE_API +
                    "/product/sampleApply/importDataFinalIsReturn",
            },
            //库存量
            num: "",
            pjtUrl: process.env.VUE_APP_BASE_API,
            // 我的待办数量
            listSample: "",
            openCheck: false,
            //退货情况
            sampleReturnList: [],
            openReturnList: false,
            //我的申请
            applyname: "",

            tableHeight: "",
            //是否显示待办
            TypeCheck: false,
            //我的申请
            state: 1,
            userId: "",
            //流程弹出框
            ApplyList: [],
            openApply: false,
            //申请按钮
            formApply: {},
            Visibleapply: false,
            //审批按钮
            VisibleCheck: false,
            formCheck: {},
            //选中get
            to_apply: [],
            list: [],
            username: [],
            color: [],
            size: [],
            productNum: [],
            isReturn: [],
            //模糊匹配
            sizeList: [],
            ColorLike: [],
            options: [], // 选项，从后端传递过来
            //搜索栏展示和收起
            isOpen: false,
            filePay: [],
            pjtUrl: process.env.VUE_APP_BASE_API,
            // 图片数量限制
            limit: 2,
            imgUpload: {
                // 设置上传的请求头部
                headers: {
                    Authorization: "Bearer " + getToken(),
                },
                // 图片上传的方法地址:
                url: process.env.VUE_APP_BASE_API + "/common/upload",
            },
            //待提交申请禁用
            to_sumbit: false,

            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 样衣申请记录表格数据
            sampleApplyList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                id: null,
                applyId: null,
                sampleTalentInfoId: null,
                sampleTalentCooperateId: null,
                sampleTalentCooperateType: null,
                templateId: null,
                templateSecondryId: null,
                templateSizeId: null,
                contactId: null,
                isReturn: null,
                onlineNumber: null,
                subOrderNumber: null,
                buyerAccount: null,
                paymentOrderNumber: null,
                paymentMethod: null,
                freight: null,
                payableAmount: null,
                fixedLine: null,
                zipCode: null,
                styleMainImage: null,
                productCode: null,
                productNum: null,
                productName: null,
                productPricing: null,
                productCost: null,
                productSettlment: null,
                productBatch: null,
                manufactureDate: null,
                expressCompany: null,
                expressNumber: null,
                deliveryTime: null,
                salesman: null,
                offlineNotes: null,
                applyStatus: null,
                isDelete: null,
                returnPhone: null,
                returnRecipient: null,
                returnAddress: null,
                returnContactId: null,
                returnExpressPickupCode: null,
                returnExpressNumber: null,
                returnDate: null,
                platform: null,
                platformId: null,
                xhsNickname: null,
                applyDateStart: null,
                applyDateEnd: null,
                productNo: null,
                signedTimeStart: null,
                signedTimeEnd: null,
                phone: null,
                recipient: null,
                address: null,
                exportParam: "personal",
                bindingSoid: null,
                productCode: null,
                brand: null,
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                sampleTalentInfoId: [
                    { required: true, message: "达人信息表ID不能为空", trigger: "blur" },
                ],
                sampleTalentCooperateId: [
                    {
                        required: true,
                        message: "笔记/直播合作ID不能为空",
                        trigger: "blur",
                    },
                ],
            },
        };
    },
    created() {

        // let obj = {
        //     idList: 2064,
        //     asidList: 911679322
        // }
        // dataComparison(obj).then((response) => { });
        selectuserList().then((response) => {
            this.userList = response
        });
        listLiveroom({
            pageNum: 1,
            pageSize: 100,
        }).then((response) => {
            response.rows.unshift({ liveStreamRoom: "非直播间申请" });
            this.liveroomList = response.rows;
            // this.total = response.total;
            // this.loading = false;
        });
        if (this.$route.query.id) {
            this.$set(this.queryParams, "sampleTalentInfoId", this.$route.query.id);
        }
        this.getroles();

        // this.changeState(this.state);

        // this.changeAddress("");
        // this.isCheck();
    },

    mounted() {
        var _this = this;
        this.resizeTable();
        window.onresize = function () {
            _this.resizeTable();
        };
    },
    //记得清空  如果在keepalive中 则使用activated  deactivated
    destroyed() {
        window.onresize = null;
    },
    filters: {
        state1(string) {
            if (string == "note") {
                return "笔记";
            }
            if (string == "live") {
                return "直播";
            }
            if (string == "VFU") {
                return "VFU";
            }
            // if (int == 2) { return "审批通过" };
        },
        state2(string) {
            if (string == "to_apply") {
                return "待提交申请";
            }
            if (string == "dingding_approval") {
                return "待钉钉审核";
            }
            if (string == "supervisor_approval") {
                return "待审核";
            }
            if (string == "product_supervisor") {
                return "待产品中心经理审核";
            }
            if (string == "manage_approval") {
                return "待经理审核";
            }
            if (string == "commodity_approval") {
                return "待商品部审核";
            }
            if (string == "shipped_ready") {
                return "待发货";
            }
            if (string == "shipped") {
                return "已发货";
            }
            if (string == "to_signed") {
                return "待签收";
            }
            if (string == "signed") {
                return "已签收";
            }
            if (string == "to_returned") {
                return "待退货";
            }
            if (string == "returning") {
                return "退货中";
            }
            if (string == "returned") {
                return "已退样";
            }
            if (string == "part_returned") {
                return "部分退样";
            }
            if (string == "not_return") {
                return "不归还";
            }
            if (string == "cancel_return") {
                return "未收到";
            }
            if (string == "end") {
                return "结束";
            }
            if (string == "canceled") {
                return "已取消";
            }
            // if (int == 2) { return "审批通过" };
        },
    },

    methods: {
        //添加库存名称
        addLibraryIdList() {
            // if (this.formData.libraryIdList.length > 4) {
            //     this.$modal.msgError("请选择不超过5个品类");
            //     return;
            // }
            if (this.formData.libraryIdList.length > 0) {
                let hasValue = false;
                for (let i = 0; i < this.formData.libraryIdList.length; i++) {
                    if (!this.formData.libraryIdList[i].id) {
                        hasValue = true;
                        break;
                    }
                }
                if (hasValue) {
                    return this.$message.warning("请先选择未选择项");
                }
                this.formData.libraryIdList.push({ id: "" });
            }
        },
        //库存名称删除
        delRow(item, index) {
            if (this.formData.libraryIdList.length > 1) {
                this.formData.libraryIdList.splice(index, 1);
                // this.$forceUpdate;
                // const E = echarts.init(this.$refs.echarts);
                // E.dispose();
            } else {
                this.$message.warning("至少选择一项");
            }
        },
        handleselectReturnRecordList() {
            selectReturnRecordList(this.sampleReturnList).then((response) => {
                this.IDList = response
                this.openIDList = true
            });
        },

        //补录
        handleReturnRecord() {
            additionalReturnRecord(this.sampleReturnList).then((response) => {
                this.$modal.msgSuccess(response.msg)
                this.openReturnList = false
            });
        },
        //确定
        handleComparison() {
            var m = [];
            this.formData.libraryIdList.forEach((item) => {
                m.push(item.id);
            });

            let obj = {
                idList: this.ids[0],
                asidList: m.toString()
            }
            dataComparison(obj).then((response) => {
                if (response.length > 0) {
                    this.sampleReturnList = response
                    this.openReturnList = true
                } else {
                    this.$modal.msgError("响应数据为空")
                }

            });
        },
        submitResponsible() {
            if (!this.formResponsible.oldResponsiblePeople) {
                this.$modal.msgError("必须输入原始责任人")
                return
            }
            if (!this.formResponsible.newResponsiblePeople) {
                this.$modal.msgError("必须输入目标责任人")
                return
            }
            transferResponsiblePeople(this.formResponsible).then((response) => {

                this.$modal.msgSuccess(response.msg)

                this.getList()
                this.openResponsible = false
            });
        },
        downLoadFile() {
            let obj = {
                templateName: "样衣申请批量导入模板",
            };
            downLoadTemplate(obj).then((response) => {
                window.location.href =
                    process.env.VUE_APP_BASE_API + response.rows[0].templateUrl;
            });
        },
        chatIDList() {
            if (this.ids.length == 0) {
                this.$modal.msgError("至少选一条数据");
                return;
            }

        },
        handleIsReturn() {
            if (this.ids.length == 0) {
                this.$modal.msgError("至少选一条数据");
                return;
            }

            getSampleApply(this.ids).then((response) => {
                this.finalIsReturnPicUrl = response.data.finalIsReturnPicUrl;
                this.openbatchReturn = true;
            });
        },
        //修改归还状态
        submitbatchReturn() {
            let list = [];
            this.ids.forEach((item) => {
                list.push({
                    id: item,
                    finalIsReturn: this.finalIsReturn,
                    finalIsReturnRemark: this.finalIsReturnRemark,
                    finalIsReturnPicUrl: this.finalIsReturnPicUrl,
                    finalIsReturnUpdateTime: this.finalIsReturnUpdateTime,
                });
            });
            batchEditIsReturn(list).then((response) => {
                this.finalIsReturnRemark = "";
                this.finalIsReturnPicUrl = "";
                this.finalIsReturnUpdateTime = "";
                this.openbatchReturn = false;
                this.getList();
            });
        },
        //模版下载
        downLoadTemplateFile() {
            let obj = {
                templateName: "样衣申请批量修改归还状态",
            };
            downLoadTemplate(obj).then((response) => {
                window.location.href =
                    process.env.VUE_APP_BASE_API + response.rows[0].templateUrl;
            });
        },
        //检测发货状态
        handlecheckPackageStatus() {
            // this.openLoading3();
            checkPackageStatus(this.ids).then((response) => {
                // this.$modal.closeLoading();
                this.$modal.msgSuccess("检查通过");
            });
        },
        //检测钉钉状态
        handlecheckDingdingStatus() {
            this.openLoading3();
            checkDingdingStatus(this.ids).then((response) => {
                this.$modal.closeLoading();
                this.changeState();
            });
        },
        //检查无信息售后单
        handlecheckAfterSaleNoInfoReq() {
            if (!this.formApply.remark) {
                this.$modal.msgError("请填写寄样原因");
                return;
            }

            axios
                .post(
                    process.env.VUE_APP_BASE_API +
                    "/product/sampleApply/checkAfterSaleNoInfoReq",
                    this.ids,
                    {
                        headers: {
                            header: {
                                // responseType: "blob"
                            },

                            Authorization: "Bearer " + getToken(),
                            // "Content-Type": "multipart/form-data",
                        }, //定义内容格式,很重要
                        // timeout: 20000,
                    }
                )
                .then((response) => {
                    console.log(response);
                    if (response.data.code == 200) {
                        this.handlecheckInventory();
                    } else if (response.data.code == 500) {
                        this.$alert(response.data.msg, "提示", {
                            confirmButtonText: "前往认领",
                        }).then(() => {
                            this.$router.push({
                                path: "/sample/returned/AfterSalesOrder",
                                query: { deptBelong: "My" },
                            });
                        });
                    }
                });
            // checkAfterSaleNoInfoReq(this.ids)
            //   .then((response) => {
            //     // if (response.code == 500) {
            //     //   this.$alert(response.msg, "提示", {
            //     //     confirmButtonText: "确定",
            //     //   });
            //     // } else
            //     if (response.code == 200) {
            //       this.handlecheckInventory();
            //     }
            //   })
            //   .catch((error) => {
            //     this.$alert(error, "提示", {
            //       confirmButtonText: "确定",
            //     });
            //   });
        },
        //检查库存
        handlecheckInventory() {
            this.openLoading2();
            checkInventory(this.ids).then((response) => {
                this.$modal.closeLoading();
                // if (response.code == 200) {
                // }
                // this.msgInventory = response.msg;
                const jsonObject = JSON.parse(response.msg);
                this.msgInventory = jsonObject.data;
                console.log(JSON.stringify(jsonObject));
                if (jsonObject.code == 200) {
                    this.submitApply();
                } else {
                    this.openInventory = true;
                }
            });
        },
        //修改对话框
        //添加颜色列表获得焦点
        onFocus() {
            // this.getData();

            // this.getSize();
            this.changeAddress("");
            // if (!this.form.colorProperty) {
            //     this.$selectRef.value.blur() //就是这一句，
            // }
        },
        submitSelf() {
            if (!this.fReturn.expressNumber) {
                this.$modal.msgError("请输入退货快递单号");
                return;
            }
            var formreturn = {
                returnMethod: "selfsending",
                sampleTalentInfoId: this.sampleTalentInfoId[0],
                applyIds: this.ids,
                ...this.fReturn,
            };
            console.log(JSON.stringify(formreturn));
            // return
            this.openLoading();
            axios
                .post(
                    process.env.VUE_APP_BASE_API +
                    "/product/sampleApply/returnApplyByApplyID",
                    formreturn,
                    {
                        headers: {
                            header: {
                                // responseType: "blob"
                            },

                            Authorization: "Bearer " + getToken(),
                            // "Content-Type": "multipart/form-data",
                        }, //定义内容格式,很重要
                        // timeout: 20000,
                    }
                )
                .then((response) => {
                    this.$modal.closeLoading();
                    if (response.data.code == 200) {
                        // if (response.data.msg == "操作完成！") {
                        this.$modal.msgSuccess("申请成功");
                        this.$router.push({
                            path: "/sample/returned/sampleReturn",
                            query: { sampleTalentInfoId: this.sampleTalentInfoId[0] },
                        });
                        // } else {
                        //   this.$modal.msgError(response.data.msg);
                        // }
                    } else if (response.data.code == 500) {
                        // this.$alert(
                        //   "快递单号已存在，请在聚水潭售后单查询该快递单号!",
                        //   "提示",
                        //   {
                        //     confirmButtonText: "确定",
                        //   }
                        // ).then(() => {
                        //   this.$router.push({
                        //     path: "/sample/returned/AfterSalesOrder",
                        //     query: { trackingNumber: this.fReturn.expressNumber },
                        //   });
                        // });
                        this.$alert(response.data.msg, "提示", {
                            confirmButtonText: "前往认领",
                        }).then(() => {
                            this.$router.push({
                                path: "/sample/returned/AfterSalesOrder",
                                query: { trackingNumber: this.fReturn.expressNumber },
                            });
                        });
                    }
                    // else {
                    //   this.$modal.msgError(response.msg);
                    // }
                });
        },
        changeAddress(val) {
            console.log(val);
            search(val).then((response) => {
                console.log(JSON.stringify(response));
                this.returnAddressList = response;
            });
        },
        changeStatus(val) {
            console.log(val);
            if (val == 0) {
                console.log(0);
                this.fReturn = {};
                // this.fReturn.expressCompany = '中通快递'
                this.noSelf = true;
            } else {
                console.log(1);
                this.fReturn = {};
                // this.fReturn.expressCompany = '中通快递'
                this.noSelf = false;
            }
        },

        //申请退货
        chatReturn(row) {
            if (this.sampleTalentInfoId.length !== 1) {
                this.$modal.msgError("请选择一个达人信息！");
                return;
            }

            listContact({ sampleTalentInfoId: this.sampleTalentInfoId[0] }).then(
                (res) => {
                    if (res.rows.length == 0) {
                        this.$modal.msgError("请添加达人收件信息！");
                        return;
                    } else if (res.rows.length > 0) {
                        this.optionsContact = res.rows;
                        console.log(JSON.stringify(this.optionsContact));
                        this.Visiblereturn = true;
                    }
                }
            );
        },
        Return() {
            this.Visiblereturn = false;
        },
        submitReturn() {
            // if (!this.fReturn.returnContactId) {
            //   this.$modal.msgError("请选择取件地址");
            //   return;
            // }
            if (!this.fReturn.sampleReturnAddressId) {
                this.$modal.msgError("请选择仓库地址");
                return;
            }
            var pickupStartTime = this.returnDate.split("-")[0];
            var pickupEndTime = this.returnDate.split("-")[1];
            console.log(JSON.stringify(pickupStartTime));
            console.log(JSON.stringify(pickupEndTime));
            var formreturn = {
                returnMethod: "pickup",
                sampleTalentInfoId: this.sampleTalentInfoId[0],
                applyIds: this.ids,
                // returnContactId: this.ids[0],
                ...this.fReturn,
                pickupStartTime: pickupStartTime,
                pickupEndTime: pickupEndTime,
            };
            console.log(JSON.stringify(formreturn));
            // return
            returnApplyByApplyID(formreturn).then((response) => {
                if (response.code == 200) {
                    if (response.msg == "操作完成！") {
                        this.$modal.msgSuccess("申请成功");
                        this.$router.push({
                            path: "/sample/returned/sampleReturn",
                            query: { sampleTalentInfoId: this.sampleTalentInfoId[0] },
                        });
                    } else {
                        this.$modal.msgError(response.msg);
                    }
                } else {
                    this.$modal.msgError(response.msg);
                }
            });
        },
        //获取库存
        getinventory() {
            inventory({
                productNo: this.form.productNo,
                colorProperity: this.form.colorProperty,
                size: this.form.size,
            }).then((res) => {
                // console.log(JSON.stringify(res.data));
                if (res.code == 200) {
                    if (res.data.length > 0) {
                        this.num = res.data[0].publicCanUseNum;
                        this.$forceUpdate();
                    } else {
                        this.$modal.msgError("该商品编码聚水潭不存在，请核对。");
                    }
                }
                // else {
                //   this.$modal.msgError(res.msg)
                // }
            });
        },

        //退货情况
        getlistSampleReturn(row) {
            listSampleReturn({ sampleTalentApplyId: row.id }).then((response) => {
                if (response.rows.length <= 0) {
                    this.$modal.msgError("暂无数据！");
                    this.openReturnList = false;
                } else {
                    this.sampleReturnList = response.rows;
                    this.openReturnList = true;
                }
            });
        },
        goto(row) {
            this.$router.push({
                path: "/sample/returned/sampleReturn",
                query: { id: row.id },
            });
        },
        // MySampleTalentApply() {
        //   selectMySampleTalentApply({ userId: this.userId, applyStatus: null }).then(res => {
        //     this.sampleApplyList = res.data
        //     // this.state = false
        //   })
        // },
        //分页
        pageList() {
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },
        //我的申请
        changeState(val) {
            this.queryParams.pageNum = 1;
            this.openCheck = false;
            // console.log(val);
            // console.log(this.userId);
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },
        //归还不归还
        changeReturn(val) {
            this.queryParams.pageNum = 1;
            // console.log();
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },
        //发货状态改变
        changeTheme(val) {
            console.log(val);
            this.queryParams.pageNum = 1;
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },
        //公司所有
        getAllList() {
            this.queryParams.createBy = "";
            alllistSampleApply(this.queryParams).then((response) => {
                this.sampleApplyList = response.rows;

                this.total = response.total;
            });
        },
        //部门记录
        getdeptlist() {
            this.queryParams.createBy = "";

            deptlistSampleApply(this.queryParams).then((response) => {
                this.sampleApplyList = response.rows;

                this.total = response.total;
            });
        },
        //流转记录
        statusList(row) {
            selectFlowInstanceRecordListExt({
                businessId: row.id,
                businessType: "sampleApply",
            }).then((response) => {
                this.ApplyList = response.data;
                this.openApply = true;
            });
        },
        handleApplyExcel() {
            var apply = [];
            this.list.forEach((item) => {
                apply.push({
                    businessId: item.id,
                    applyStatus: item.applyStatus,
                    applyId: this.userId,
                });
            });
            // console.log();
            // apply = JSON.stringify(apply);
            startApplyExcel(apply).then((data) => {
                const isBlob = blobValidate(data);
                if (isBlob) {
                    const blob = new Blob([data]);
                    saveAs(blob, "申请表");
                }
            });
            // this.download(
            //   "product/sampleApply/startApplyExcel",
            //   {
            //     ...apply,
            //   },
            //   // headers: {
            //   // header: { responseType: "blob" },

            //   // Authorization: "Bearer " + getToken(),
            //   // "Content-Type": "application/json",
            //   // },
            //   `申请表_${new Date().getTime()}.xlsx`
            // );
        },
        //申请按钮
        submitApply() {
            // if (!this.formApply.remark) {
            //   this.$modal.msgError("请输入申请理由");
            //   return;
            // }
            var apply = [];
            this.list.forEach((item) => {
                apply.push({
                    businessId: item.id,
                    applyStatus: item.applyStatus,
                    applyId: this.userId,
                    ...this.formApply,
                });
            });

            // this.$modal.confirm('是否直接提交？').then(function () {

            //   return startApplyFlow(apply);
            // }).then((res) => {
            //   this.Visibleapply = false
            //   this.getList();
            //   if (res.code == 200) {

            //     if (res.msg == '') {
            //       this.$modal.msgSuccess('申请成功')
            //     } else {
            //       this.$modal.msgError(res.msg)
            //     }
            //   }
            // }).catch(() => { });
            console.log(JSON.stringify(apply.length));
            this.Visibleapply = false;
            this.openLoading();
            startApplyFlow(apply).then((res) => {
                this.$modal.closeLoading();

                this.getList();
                if (res.code == 200) {
                    if (res.msg == "") {
                        this.$modal.msgSuccess("申请成功");
                        this.openInventory = false;
                        this.getList();
                    } else {
                        this.$modal.msgError(res.msg);
                    }
                }
            });
        },
        closeInventory() {
            this.openInventory = false;
            this.Visibleapply = false;
        },
        // 打开加载层
        openLoading3() {
            this.$modal.loading("正在检测钉钉状态，请稍候！");
        },
        // 打开加载层
        openLoading2() {
            this.$modal.loading("正在检查库存，请稍候！");
        },
        // 打开加载层
        openLoading() {
            this.$modal.loading("正在提交申请，请稍候！");
        },

        //判断是否打开申请
        ToDoapply() {
            if (this.to_apply.length == 0) {
                this.$modal.msgError("请选择至少一条待申请记录信息！");
                return;
            }
            // if (this.color.indexOf(null) >= 0) {
            //   this.Visibleapply = false;
            //   this.$modal.msgError("请完善申请记录信息！颜色");
            //   return;
            // }
            // if (this.size.indexOf(null) >= 0) {
            //   this.Visibleapply = false;
            //   this.$modal.msgError("请完善申请记录信息！尺寸");
            //   return;
            // }
            // if (this.productNum.indexOf(null) >= 0) {
            //   this.Visibleapply = false;
            //   this.$modal.msgError("请完善申请记录信息！数量");
            //   return;
            // }
            // if (this.isReturn.indexOf(null) >= 0) {
            //   this.Visibleapply = false;
            //   this.$modal.msgError("请完善申请记录信息！归还");
            //   return;
            // }
            const invalidcolorProperty = this.list.filter(
                (product) => product.colorProperty == null
            );

            if (invalidcolorProperty.length > 0) {
                const errorMessage = invalidcolorProperty
                    .map((p) => `ID为 ${p.id}`)
                    .join("\n");
                this.$modal.msgError(`${errorMessage}\n颜色，请检查后再提交`);
                this.Visibleapply = false;
                return;
            }
            const invalidsize = this.list.filter((product) => product.size == null);

            if (invalidsize.length > 0) {
                const errorMessage = invalidsize.map((p) => `ID为 ${p.id}`).join("\n");
                this.$modal.msgError(`${errorMessage}\n尺寸，请检查后再提交`);
                this.Visibleapply = false;
                return;
            }
            const invalidproductNum = this.list.filter(
                (product) => product.productNum == null
            );

            if (invalidproductNum.length > 0) {
                const errorMessage = invalidproductNum
                    .map((p) => `ID为 ${p.id}`)
                    .join("\n");
                this.$modal.msgError(`${errorMessage}\n数量，请检查后再提交`);
                this.Visibleapply = false;
                return;
            }
            const invalidisReturn = this.list.filter(
                (product) => product.isReturn == null
            );

            if (invalidisReturn.length > 0) {
                const errorMessage = invalidisReturn
                    .map((p) => `ID为 ${p.id}`)
                    .join("\n");
                this.$modal.msgError(`${errorMessage}\n是否归还，请检查后再提交`);
                this.Visibleapply = false;
                return;
            }
            const invalidProducts = this.list.filter(
                (product) =>
                    product.liveRoomName == null || product.liveRoomName == "非直播间"
            );

            if (invalidProducts.length > 0) {
                const errorMessage = invalidProducts
                    .map((p) => `ID为 ${p.id}`)
                    .join("\n");
                this.$modal.msgError(
                    `${errorMessage}\n直播间名字没在样衣直播间列表中，请检查后再提交`
                );
                this.Visibleapply = false;
                return;
            }

            if (this.to_apply.length == 1 && this.to_apply[0] == "to_apply") {
                if (this.username.length == 1 && this.username[0] == this.applyname) {
                    console.log(JSON.stringify(this.ids));
                    const ids = this.ids;
                    isValidData(ids).then((response) => {
                        if (response.code == 200) {
                            this.Visibleapply = true;
                        } else {
                            this.Visibleapply = false;
                            this.$modal.msgError(response.msg);
                        }
                    });
                } else {
                    this.Visibleapply = false;
                    this.$modal.msgError("请选择本人申请记录信息！");
                    return;
                }
            } else {
                this.Visibleapply = false;
                this.$modal.msgError("订单处于 “非待提交申请”状态，暂不可申请。");
                return;
            }

            // if(this.filter)
            // for (let index = 0; index < this.to_apply.length; index++) {
            //   // const element = array[index];

            // }
        },
        cancelApply() {
            this.Visibleapply = false;
        },
        //admin申请按钮
        ToDobutton() {
            this.openLoading();
            uploadIst(this.ids).then((res) => {
                this.$modal.closeLoading();

                this.getList();
                if (res.code == 200) {
                    // if (res.msg == "") {
                    this.$modal.msgSuccess("申请成功");
                    // }
                } else {
                    this.$modal.msgError(res.msg);
                }
            });
        },
        getroles() {
            // var userId = null
            getInfo().then((res) => {
                console.log(JSON.stringify(res));
                this.applyname = res.user.dept.deptName + "-" + res.user.userName;
                console.log(JSON.stringify(this.applyname));
                this.userId = res.user.userId;
                // this.queryParams.createBy = this.userId;
                console.log(JSON.stringify(this.userId));
                //当前操作用户角色
                this.roles = res.roles;
                console.log(JSON.stringify(this.roles));
                this.getList();
            });
        },
        isCheck() {
            selectSampleTalentApplyToDo().then((res) => {
                if (res.data.length > 0) {
                    this.TypeCheck = true;
                    this.listSample = res.data.length;
                } else {
                    this.TypeCheck = false;
                }
            });
        },
        //我的待办
        ToDo() {
            selectSampleTalentApplyToDo().then((res) => {
                this.sampleApplyList = res.data;
                if (res.data.length > 0) {
                    this.openCheck = true;
                } else {
                    this.openCheck = false;
                }
                this.total = this.sampleApplyList.length;
            });
        },
        //是否审批
        ToDoCheck() {
            if (this.list.length == 0) {
                this.$modal.msgError("请选择一条记录信息！");
                return;
            }
            // console.log(JSON.stringify());

            // this.to_apply.forEach(item => {
            //   if (item.('to_apply')) {
            //     this.VisibleCheck = false
            //     // return
            //   } else {
            //     this.VisibleCheck = true
            //   }

            // })
            if (this.to_apply.indexOf("to_apply") >= 0) {
                this.VisibleCheck = false;
                this.$modal.msgError("请选择待审批记录信息！");
                return;
            } else {
                this.VisibleCheck = true;
            }
        },
        cancelCheck() {
            this.VisibleCheck = false;
        },
        submitCheck() {
            var check = [];
            this.list.forEach((item) => {
                check.push({
                    businessId: item.id,
                    applyStatus: item.applyStatus,
                    ...this.formCheck,
                });
            });
            console.log(JSON.stringify(check));
            // return
            SampleTalentApplyCheck(check).then((response) => {
                if (response.code == 200) {
                    this.$modal.msgSuccess("申批成功");
                    this.VisibleCheck = false;
                    this.ToDo();
                }
            });
        },
        // //发起退货
        // chatReturn() {
        //   if (this.list.length > 1 || this.list.length == 0) {
        //     this.$modal.msgError("请选择一条记录信息！");
        //     return;
        //   }
        //   // if (this.to_apply.length == 1 && this.to_apply[0] == 'to_apply') {
        //   //   this.Visibleapply = true
        //   // } else {
        //   //   this.Visibleapply = false
        //   //   this.$modal.msgError('包含非待申请记录信息！')
        //   //   return
        //   // }
        //   returnApply(this.list[0]).then((response) => {
        //     if (response.code == 200) {
        //       this.$modal.msgSuccess("申请成功");
        //       this.getList();
        //     }
        //   });
        // },

        // chatReturn() {
        //   if (this.list.length > 1 || this.list.length == 0) {
        //     this.$modal.msgError("请选择一条记录信息！");
        //     return;
        //   }
        //   returnApply(this.list[0]).then((response) => {
        //     if (response.code == 200) {
        //       this.$modal.msgSuccess("申请成功");
        //       this.getList();
        //     }
        //   });
        // },

        //修改对话框
        //添加颜色列表获得焦点
        onFocus() {
            this.getData();

            this.getSize();
            // if (!this.form.colorProperty) {
            //     this.$selectRef.value.blur() //就是这一句，
            // }
        },
        testSize() {
            this.getinventory();
        },

        //修改对话框
        /* 获取颜色列表 */
        getSize(key) {
            console.log(JSON.stringify(key));
            // this.loading = true;
            // return
            listAll({
                productNo: this.form.productNo,
                colorProperty: this.form.colorProperty,
            }).then((res) => {
                // this.loading = false;
                this.sizeList = res;
                console.log(JSON.stringify(res));
            });
        },
        /* 获取颜色列表 */
        getData(key) {
            console.log(JSON.stringify(key));
            // this.loading = true;
            // return
            productNoColorLike({ productNo: this.form.productNo, color: key }).then(
                (res) => {
                    // this.loading = false;
                    this.ColorLike = res.data;
                    console.log(JSON.stringify(this.ColorLike));
                }
            );
        },

        /* 获取货号列表 */
        getDatas(key) {
            console.log(JSON.stringify(key));
            this.loading = true;
            // return
            productNoLike(key).then((res) => {
                this.loading = false;
                this.options = res.data;
                console.log(JSON.stringify(this.options));
            });
        },
        //搜索栏展示与收起
        shouqi() {
            this.openCheck = false;
            // console.log(1);
            this.isOpen = !this.isOpen;
        },
        //点击某一行
        t(row, column, cell, event) {
            console.log(row, column, cell, event);
            this.handleUpdate(row);
        },
        // formatData(row) {
        //   let rowPerson = (row) || [];
        //   let arr = [];
        //   rowPerson.forEach(item => {
        //     //如果数据特别多的话,还可以在这里加if判断,仅展示规定的数据
        //     arr.push(item.receiverState, item.receiverCity, item.receiverDistrict, item.address);
        //   });
        //   //
        //   return arr.join("/");
        // },
        /** 查询样衣申请记录列表 */
        getList() {
            this.loading = true;
            listSampleApply(this.queryParams).then((response) => {
                this.sampleApplyList = response.rows;
                // this.sampleApplyList.address = response.rows.receiverState + response.rows.receiverCity + response.rows.receiverDistrict + response.rows.address
                // console.log(JSON.stringify(this.sampleApplyList.address));
                this.total = response.total;
                this.loading = false;
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {
                id: null,
                sampleTalentInfoId: null,
                sampleTalentCooperateId: null,
                sampleTalentCooperateType: null,
                templateId: null,
                templateSecondryId: null,
                templateSizeId: null,
                contactId: null,
                isReturn: null,
                remark: null,
                onlineNumber: null,
                subOrderNumber: null,
                buyerAccount: null,
                paymentOrderNumber: null,
                paymentMethod: null,
                freight: null,
                payableAmount: null,
                fixedLine: null,
                zipCode: null,
                styleMainImage: null,
                productCode: null,
                productNum: null,
                productName: null,
                productPricing: null,
                productCost: null,
                productSettlment: null,
                productBatch: null,
                manufactureDate: null,
                expressCompany: null,
                expressNumber: null,
                deliveryTime: null,
                salesman: null,
                offlineNotes: null,
                applyStatus: null,
                isDelete: null,
                createBy: null,
                createTime: null,
                updateBy: null,
                updateTime: null,
                returnPhone: null,
                returnRecipient: null,
                returnAddress: null,
                returnContactId: null,
                returnExpressPickupCode: null,
                returnExpressNumber: null,
                returnDate: null,
                isReturnRemark: null,
            };
            this.resetForm("form");
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.queryParams.pageSize = 10;
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                // this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.openCheck = false;
            this.resetForm("queryForm");
            this.queryParams = {};
            this.queryParams.exportParam = "personal";
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map((item) => item.id);
            this.single = selection.length !== 1;
            this.multiple = !selection.length;
            this.list = selection.map((item) => item);
            console.log(JSON.stringify(this.list));
            var username = selection.map((item) => item.buyerAccount);
            console.log(JSON.stringify(username));
            this.username = Array.from(new Set(username));

            console.log(JSON.stringify(this.username));

            var to_apply = selection.map((item) => item.applyStatus);
            console.log(JSON.stringify(to_apply));
            this.color = selection.map((item) => item.colorProperty);

            this.size = selection.map((item) => item.size);
            console.log(JSON.stringify(this.size));

            this.productNum = selection.map((item) => item.productNum);
            console.log(JSON.stringify(this.productNum));

            this.isReturn = selection.map((item) => item.isReturn);

            var sampleTalentInfoId = selection.map((item) => item.sampleTalentInfoId);
            this.sampleTalentInfoId = Array.from(new Set(sampleTalentInfoId));
            // var apply = []
            // to_apply.forEach(item => {
            //   if (item.includes('to_apply')) {

            //     apply.push(item)
            //   }

            // })
            this.to_apply = Array.from(new Set(to_apply));

            console.log(JSON.stringify(this.to_apply));
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true;
            this.title = "添加样衣申请记录";
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const id = row.id || this.ids;
            getSampleApply(id).then((response) => {
                this.finalIsReturnPicUrl = response.data.finalIsReturnPicUrl;
                this.form = response.data;
                //不可编辑状态判断是否处于“待提交申请”
                if (response.data.applyStatus !== "to_apply") {
                    //
                    this.to_sumbit = true;
                } else {
                    // console.log(5555454);
                    this.to_sumbit = false;
                }

                console.log(JSON.stringify(response.data));
                if (row.buyerAccount == this.applyname) {
                    if (response.data.applyStatus == "dingding_approval") {
                        this.open = false;
                        this.$modal.msgError("订单处于 “待钉钉审核”状态，暂不可修改。");
                        return;
                    } else {
                        this.open = true;
                    }
                } else {
                    this.open = false;
                    this.$modal.msgError("请选择本人申请记录信息！");
                    return;
                }
                if (row.colorProperty) {
                    this.getinventory();
                }

                this.title = "修改样衣申请记录";
            });
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate((valid) => {
                if (valid) {
                    if (this.form.id != null) {
                        updateSampleApply(this.form).then((response) => {
                            if (response.msg == "") {
                                this.$modal.msgSuccess("操作成功");
                            } else {
                                this.$modal.msgError(response.msg);
                            }
                            this.open = false;
                            this.changeEdit();
                        });
                    } else {
                        addSampleApply(this.form).then((response) => {
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.changeEdit();
                        });
                    }
                }
            });
        },
        changeEdit(val) {
            // console.log(val);
            // console.log(this.userId);
            if (this.queryParams.exportParam == "personal") {
                // this.queryParams.createBy = this.userId;
                this.queryParams.applyId = this.userId;
                //个人申请
                this.getList();
            } else if (this.queryParams.exportParam == "depart") {
                //部门记录
                this.getdeptlist();
            } else if (this.queryParams.exportParam == "all") {
                //公司所有
                this.getAllList();
            }
        },

        addText() {
            if (!this.demo) {
                this.$modal.msgError("请输入内容");
                return;
            }
            let address = this.demo.replace(/\s+/g, " ");
            const result = AddressParse.parse(address);

            this.form.phone = result[0].mobile ? result[0].mobile : "";
            this.form.recipient = result[0].name ? result[0].name : "";
            this.form.receiverState = result[0].province ? result[0].province : "";
            this.form.receiverCity = result[0].city ? result[0].city : "";
            this.form.receiverDistrict = result[0].area ? result[0].area : "";
            this.form.address = result[0].details;
            this.seletekey(this.form.receiverState, "province");
            this.seletekey(this.form.receiverCity, "city");
            this.seletekey(this.form.receiverDistrict, "area");
            // axios({
            //   method: "post",
            //   url: "https://wangzc.wang/smAddress",
            //   // url: "http://47.97.123.182:1399/smAddress",
            //   data: {
            //     address: address,
            //   },
            // }).then((res) => {
            //   // console.log(JSON.stringify(res.data));
            //   this.form.phone = res.data.phone ? res.data.phone : "";
            //   this.form.recipient = res.data.name ? res.data.name : "";
            //   this.form.receiverState = res.data.province ? res.data.province : "";
            //   this.form.receiverCity = res.data.city ? res.data.city : "";
            //   this.form.receiverDistrict = res.data.county ? res.data.county : "";
            //   this.form.address = res.data.street
            //     ? res.data.street + res.data.address
            //     : res.data.address;
            //   this.seletekey(this.form.receiverState, "province");
            //   this.seletekey(this.form.receiverCity, "city");
            //   this.seletekey(this.form.receiverDistrict, "area");
            // });
        },
        seletekey(e, type) {
            if (e) {
                switch (type) {
                    case "province":
                        Object.keys(this.provinces).filter((item) => {
                            if (this.provinces[item] === e) {
                                this.citys = this.pcaaData[item];
                            }
                        });
                        break;
                    case "city":
                        Object.keys(this.citys).filter((item) => {
                            if (this.citys[item] === e) {
                                this.areas = this.pcaaData[item];
                            }
                        });
                        break;
                    case "area":
                        this.form.receiverDistrict = e;
                        this.$forceUpdate();
                        break;
                }
            }
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            // if (row.buyerAccount !== this.applyname) {
            //   this.$modal.msgError('请选择本人申请记录信息！')
            //   return
            // }
            const ids = row.id || this.ids;

            this.$modal
                .confirm('是否确认删除样衣申请记录编号为"' + ids + '"的数据项？')
                .then(function () {
                    return delSampleApply(ids);
                })
                .then(() => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => { });
        },
        /** 导出按钮操作 */
        handleExport() {
            if (this.queryParams.exportParam == "all") {
                this.queryParams.createBy = "";
            } else if (this.queryParams.exportParam == "personal") {
                this.queryParams.createBy = this.userId;
            }
            this.download(
                "product/sampleApply/export",
                {
                    ...this.queryParams,
                },
                `sampleApply_${new Date().getTime()}.xlsx`
            );
        },
        //图片上传前的相关判断
        beforeAvatarUpload(file) {
            // const isJPG = file.type == 'image/jpeg' || file.type == 'image/png';
            const isLt2M = file.size / 1024 / 1024 < 100;
            // if (!isJPG) {
            //     this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
            // }
            if (!isLt2M) {
                this.$message.error("上传导入文件大小不能超过 100MB!");
            }
            this.openUploadLoading();
            return isLt2M;
        },
        //图片预览
        handlePictureCardPreview(file) {
            this.picUrl = file.url;
            this.imageUrl = file.url;
            // this.dialogVisible = true;
        },
        //部门文件导入修改打开
        daoru() {
            this.dialogVisible = true;
        },
        // 打开加载层
        openUploadLoading() {
            this.$modal.loading("正在导入，请稍候！");
        },
        //批量修改导入
        handlenewUploadSuccessDaoru(response, file) {
            console.log(JSON.stringify(file));
            console.log(JSON.stringify(response));
            this.openbatchReturn = false;
            this.getList();
            this.$modal.closeLoading();
            this.openmsg = true;
            this.msg = response.msg;
        },
        //文件导入成功回传

        handlePictureSuccessPic(response, file) {
            console.log(JSON.stringify(file));
            console.log(JSON.stringify(response));
            this.dialogVisible = false;
            this.$modal.closeLoading();
            this.openmsg = true;
            this.msg = response.msg;

            //设置图片访问路径 （url 后台传过来的的上传地址）
            // this.picUrl = file.response.url;
            // const url = file.response.fileName;
            // this.file = file.response.url;
            // console.log(JSON.stringify(this.file));
            // if (res.code == 200) {

            //   this.dialogVisible = false

            //   if (res.msg == '操作成功') {

            //     this.$modal.msgSuccess('导入成功')
            //   } else {
            //     this.$modal.msgError(res.msg);
            //   }
            //   this.getList();
            //   // return true
            // } else {
            //   this.$modal.msgError(res.msg);
            //   this.dialogVisible = true
            //   // this.$message.msgError('该颜色未在字典定义')
            //   return
            // }
        },

        // 文件个数超出
        handleExceed() {
            this.$modal.msgError(`上传链接文件数量不能超过 ${this.limit} 个!`);
        },
        // 上传文件让第二次覆盖第一的文件
        changeFile1(file, fileList) {
            if (fileList.length > 1) {
                this.fileLi = fileList.slice(-1);

                // this.fileList = [fileList[fileList.length - 1]]//这一步，是 展示最后一次选择文件
            }
            // this.fileSpecial = fileList;
        },
        // table自动高度
        returnTableHeight(ref, bottomOffset) {
            let height = null;
            height =
                window.innerHeight - ref.getBoundingClientRect().top - bottomOffset;
            return height;
        },

        resizeTable() {
            this.$nextTick(() => {
                this.tableHeight = this.returnTableHeight(this.$refs.tableDom, 100);
            }, 0);
        },
        //logo图片
        handlelogourl(event) {
            const items = (event.clipboardData || window.clipboardData).items;
            let file = null;
            if (!items || items.length === 0) {
                this.$message.error("当前浏览器不支持本地");
                return;
            }
            // 搜索剪切板items
            for (let i = 0; i < items.length; i++) {
                if (items[i].type.indexOf("image") !== -1) {
                    file = items[i].getAsFile();
                    break;
                }
            }
            if (!file) {
                this.$message.error("粘贴内容非图片");
                return;
            }
            if (this.filelogourl.length >= this.limit) {
                this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); // 图片数量超出
                return;
            }
            this.$refs.uploadlogourl.handleStart(file); // 将粘贴过来的图片加入预上传队列
            this.$refs.uploadlogourl.submit(); // 提交图片上传队列
        },
        //上传
        changelogourl(file, fileList) {
            // this.fileList = fileList
            console.log("成功", file, fileList);
            console.log(JSON.stringify(file));
            console.log(JSON.stringify(fileList));
            if (fileList.length > 1) {
                this.filelogourl = fileList.slice(-1);
            }
        },
        Removelogourl(file, fileList) {
            console.log(JSON.stringify(file));
            console.log(JSON.stringify(fileList));
            this.finalIsReturnPicUrl = "";
        },

        uploadlogourl(res, file, fileList) {
            console.log(JSON.stringify(file.response.fileName));
            this.finalIsReturnPicUrl = file.response.fileName;
        },
    },
};
</script>
<style lang="scss" scoped>
::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
}

// ::v-deep input[type='number'] {
//   // -moz-appearance: textfield !important;
// }

.el-dialog-div {
    overflow-x: hidden;
    height: 50vh;
}

span.textname {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.el-input.is-disabled ::v-deep .el-input__inner {
    color: #606266;
    background-color: white;
    border: none;
}

.el-textarea.is-disabled ::v-deep .el-textarea__inner {
    width: 500px;
    color: #606266;
    background-color: white;
    border: none;
    cursor: pointer;
    resize: none;
}
</style>
public class AddressParsing extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 唯一标识符 */
    private Long id;

    /** 完整的地址信息 */
    @Excel(name = "完整的地址信息")
    private String fullAddress;

    /** 省份名称 */
    @Excel(name = "省份名称")
    private String province;

    /** 城市名称 */
    @Excel(name = "城市名称")
    private String city;

    /** 区县名称 */
    @Excel(name = "区县名称")
    private String district;

    /** 详细的地址描述，如街道、门牌号等 */
    @Excel(name = "详细的地址描述，如街道、门牌号等")
    private String detailedAddress;

    /** 收件人的电话号码 */
    @Excel(name = "收件人的电话号码")
    private String recipientPhone;

    /** 收件人的名字 */
    @Excel(name = "收件人的名字")
    private String recipientName;


}